Re: [R] Plot by FIPS Code using Shapefiles

2015-05-08 Thread Shouro Dasgupta
Excellent suggestions Professors! I really appreciated it. This is what I am using: library(data.table) > library(rgdal) > library(colourschemes) > library(RColorBrewer) > library(maptools) > library(maps) > library(ggmap) > library(classInt) max_change is my csv file while shapes is my spatial

Re: [R] Plot by FIPS Code using Shapefiles

2015-05-06 Thread Shouro Dasgupta
Dear Anthony, Thanks again for your reply. The following worked for merge: merged_data <- merge(shapes_fips,max_change,by="FIPS",all.x=T, all.y=F) However, I think I am doing something wrong - as I have 3109 FIPS code in my original data but when I merge with the shapes file SpatialPolygonsDat

Re: [R] Plot by FIPS Code using Shapefiles

2015-05-06 Thread Roger Bivand
Corey Sparks utsa.edu> writes: > > Joining data the way you're doing it is dangerous, Roger Bivand and others > describes a standard way to do this process here: > http://r-sig-geo.2731867.n2.nabble.com/Merging-shapefiles-and-csv-td7586839.html Quite right - the chunks Corey is referring to ar

Re: [R] Plot by FIPS Code using Shapefiles

2015-05-06 Thread Corey Sparks
Joining data the way you're doing it is dangerous, Roger Bivand and others describes a standard way to do this process here: http://r-sig-geo.2731867.n2.nabble.com/Merging-shapefiles-and-csv-td7586839.html And I do an example using US Census data here, using merge(): http://spatialdemography.org/w

Re: [R] Plot by FIPS Code using Shapefiles

2015-05-05 Thread Anthony Damico
so check the unique number of fips codes in the objects before and after > merged_data <- merge(shapes_fips,max_change,by="FIPS",all.X=T, all.y=T) also note that all.X should be all.x and you might want to use FALSE for one or both of those On Tue, May 5, 2015 at 11:40 AM, Shouro Dasgupta wro

Re: [R] Plot by FIPS Code using Shapefiles

2015-05-05 Thread Shouro Dasgupta
Hello, Thank you for your reply. My original data has 3109 FIPS codes. Is there a way to merge only this data into the shapefiles? I hope I am clear. Thank you also for the link, I am trying to do something like this: https://gist.github.com/reubano/1281134. Thanks again! Sincerely, Shouro On

Re: [R] Plot by FIPS Code using Shapefiles

2015-05-05 Thread Anthony Damico
hi, after running each individual line of code above, check that the object still has the expected number of records and unique county fips codes. it looks like length( shapes$GEOID ) == 3233 but nrow( merged_data ) == 3109. the way for you to debug this is for you to go through line by line after

[R] Plot by FIPS Code using Shapefiles

2015-05-05 Thread Shouro Dasgupta
I am trying to plot data by FIPS code using county shapes files. library(data.table) > library(rgdal) > library(colourschemes) > library(RColorBrewer) > library(maptools) > library(maps) > library(ggmap) I have data by FIPS code which looks like this: > > > dput(head(max_change)) > structure(lis