0

I am having trouble taking the function from this question (R convert zipcode or lat/long to county) to add county and state names to my file:

structure(df)
  Recovery.Date SPECIES_ID LAT_FLOAT LON_FLOAT   ZIP
9/23/2009       1720  42.91667 -71.41667  3051
10/8/2006       1440     42.75 -72.41667  3451
10/17/2011       1330     39.25 -74.91667  8316
2/4/2012       1690     39.25 -75.91667 21050
12/31/2009       1320     38.25    -75.25 21837

I want to take the lat_float and long_float values into the function and then add county and state (separately or together) as a new column in df. Any help would be greatly appreciated.

Community
  • 1
  • 1
tjr
  • 607
  • 2
  • 7
  • 20

1 Answers1

1

Step 1 - Create Data.frame pointsDF

pointsDF <- subset(df, select=c("LON_FLOAT", "LAT_FLOAT"))

Step 2 - Make sure you have the right projection/datum

Step 3 - Follow the accepted answer from here.

Step 4 - Merge or Join your two datasets with Lon== & LAT== conditions or you combine lon+lat in one variable on both sides and use it has a key.

Community
  • 1
  • 1
Kvasir EnDevenir
  • 907
  • 1
  • 10
  • 25