Whmmmmm. I ran installed.packages() from the command line and its shows the geohashTools package libpath as "/databricks/spark/R/lib" (version 0.3.1) so I am assuming I've got it loaded. So then I ran the following test:
%r
lat <- c(24.123, 45.123)
long <- c(145.123, 130.124)
test <- gh_encode(lat, long, precision = 9L)
test
[1] "xhrlnr7qd" "ybh89n3ks"
So the command works but the following code
# add geohash
my_tbl <- my_tbl %>%
mutate(geo_hash = gh_encode(Latitude, Longitude, precision = 9L)
results in the following error message:
Error in Use("escape") : Error in UseMethod("escape") :
no application method for 'escape' applied to an object of class "c('my_tbl', 'tbl_lazy', 'tbl')"
I'm to new to databricks to have any clue what the error is trying to tell me.
Any other suggestions?
----------------------
I just couldn't get the R gh_encode function to work on the Spark df so I ran the collect() function and then re-ran the mutate and gh_encode functions on the R data.frame and converted back to a Spark dataframe. That appears to have worked. However not the optimal solution (need to work in the Spark dataframe) but worked.