Hi I have many data frame like this
id oldid yr mo dy lon lat
1 01206295 Aberfeldy 1885 3 22 -127.1 -31.78
2 05670001 05670005 1885 3 22 -4.38 49.15
3 06279 06279 1885 3 22 -123.5 37.5
4 106251 06323 1885 3 22 178.5 19.5
5 58FFF3618 58FFF3618 1885 3 22 -0.73 69.73
6 Achille.F Achille.F 1885 3 22 -35.62 -2.98
stored in different files myfiles
and I am trying to plot the (lon,lat) points for each of them with the colour chosen according to the id value. So far I am doing like this
for (i in 1:length(myfiles)){
colnames(myfilesContent[[i]]) <-c("id","oldid","yr","mo","dy","lon","lat")
p <- ggplot() + geom_polygon(data=world_map,aes(x=long, y=lat,group=group))
myfilesContent[[i]]$lon <- as.numeric(myfilesContent[[i]]$lon)
myfilesContent[[i]]$lat <- as.numeric(myfilesContent[[i]]$lat)
p + geom_point(data=myfilesContent[[i]], aes(x=lon, y=lat, fill=as.factor(id)), size = 4, shape = 21, show_guide=FALSE)
print(p)
}
Anyway I am not sure that if an id is in different files it will be assigned with the same colour
Many thanks
id
(like I did in my previous answer to your question), then you shouldn't have a problem. – Jaap