I have a with multiple tbl's nested inside a list. All of the tbl df's have a column for ZIPCode. I have a table where I received data from the zipcode package so I could obtain latitude and longitude for each of the zipcodes.
I'd like to left join the latitude and longitude onto each of the tbl's so I could use later for leaflet. I tried to set it up such as:
zip = lapply(myfiles, function(x){
z = left_join(myfiles, zip_filtered, by=c("ZIPCode"="zip"))
return(z)
})
Which throws the following error:
Error in UseMethod("left_join") : no applicable method for 'left_join' applied to an object of class "list"
I then tried the following to pass this through:
zip = lapply(myfiles, function(x){
z = x[,left_join(x, zip_filtered, by=c("ZIPCode"="zip"))]
return(z)
})
Which gives me the following: Error: Unsupported index type: tbl_df.
The best scenario would be just to append the two columns latitude and longitude to all six tbl_df's in the list but unsure how to do that which is why I started going down this route.
Thanks!