The facet_grid
docs state:
a formula with the rows (of the tabular display) on the LHS and the columns (of the tabular display) on the RHS; the dot in the formula is used to indicate there should be no faceting on this dimension (either row or column). The formula can also be provided as a string instead of a classical formula object
facet_wrap
docs state:
Either a formula or character vector. Use either a one sided formula, ~a + b, or a character vector, c("a", "b").
The examples in both help pages are designed to illustrate what's going on, but you can mock up your own examples to see what the differences are. e.g.:
library(ggplot2)
gg <- ggplot(mtcars, aes(mpg, wt)) + geom_point()
gg + facet_wrap(~cyl)
gg + facet_wrap("cyl")
gg + facet_wrap(~gear)
gg + facet_wrap("gear")
gg + facet_wrap(gear~cyl)
gg + facet_wrap(c("gear", "cyl"))
gg + facet_wrap(cyl~gear)
gg + facet_wrap(c("cyl", "gear"))
That's the best way to get a mental association with the idiom IMO.