This looks to be the same bug as Issue#480. Copying Hadley's code in 480:
library(reshape2) # for melt
crimes <- data.frame(state = tolower(rownames(USArrests)), USArrests)
crimesm <- melt(crimes, id = 1)
states_map <- map_data("state")
ggplot(crimes, aes(map_id = state)) + geom_map(aes(fill = Murder), map = states_map) + expand_limits(x == states_map$long, y = states_map$lat) + annotation_map(states_map) + coord_map()
Gets the error "Error in validDetails.polygon(x) : 'x' and 'y' and 'id' must all be same length".
this should be fixed in 0.9.1. Are you using that version?
I downloaded and installed the new package today so I presume it is the latest and greatest. When I tried Hadley's original code with just geom_map() and coord_map() it worked. But when I added annotation_map() (see code) it failed with the original error for Issue#480.
Got it. I've submitted a pull request for a fix.
annotation_map: get group id from munched data (Fixes #568)