Error could not find function "call_geolocator_latlon" in trying to use tigris to get census tract codes

400 views Asked by At

I have a dataset with latitudes in one column and longitudes in another, and am trying to get the census tract for each location. I've downloaded the tigris package and have used a couple different code options, but I keep getting this following error:

"Error in call_geolocator_latlon(row["lat"], row["long"]) : could not find function "call_geolocator_latlon"

which makes it sound like perhaps an issue with the package? Would appreciate any help here!

Code I

data <- read.csv("listings_2015to2020_latlong_zip_only4.csv")

data$census_code <- apply(data, 1, function(row) call_geolocator_latlon(row['lat'], row['long']))

**Error in call_geolocator_latlon(data$lat[i], data$long[i]) : 
  could not find function "call_geolocator_latlon"**

Code II

data$census_code <- NA 

for(i in 1:nrow(data)){   
data$census_code[i] <-  call_geolocator_latlon(data$lat[i], data$long[i]) 
} 

**Error in call_geolocator_latlon(data$lat[i], data$long[i]) : 
  could not find function "call_geolocator_latlon"**

Any help will be greatly appreciated!

0

There are 0 answers