Searched heavily and couldn't find a response.
I'm struggling with the "lookup" function in the qdap library. I have a list of city names in data frame CityCountry; here's the code and str:
CityCountry <- data.frame(City = as.character(rownames(spint)))
CityCountry <- as.character(CityCountry)
str(CityCountry)
chr "c(18, 40, 55, 64, 68, 70, 82, 86, 90, 107, 121, 127, 144, 152, 163, 184, 194, 205, 210, 211, 213, 217, 218, 223, 226, 227, 228,"| __truncated__
spint is a shortest paths data frame, which uses the city names in question as the rownames. I want to grab these, use them to create a new data frame, lookup the country corresponding to each city in data frame routes_lookup. Here's the str(routes_lookup) and my lookup function:
str(routes_lookup)
'data.frame': 2792 obs. of 2 variables:
$ City_Dest : chr "Buenos Aires" "Buenos Aires" "Mar Del Plata" "Mar Del Plata" ...
$ Country_Dest: Factor w/ 240 levels "Afghanistan",..: 9 9 9 9 9 9 9 152 152 170 ...
CityCountry$Country <- lookup(CityCountry, routes_lookup)
Here's the error I keep getting. I've tried toying with it plenty, but the above function call seems to be closest to correct (although of course not quite there).
Error in exists(x, envir = envr) :
variable names are limited to 10000 bytes
I would certainly think the problem is illustrated by str(CityCountry) shown above. But the data frame contains a column of type chr, and so does the City_Dest column in routes_lookup. How do I make these two columns of identical data types?