This is the exact message:
Warning in do.call(.f, args, envir = .env) :
'what' must be a function or character string
Working in an Azure Databricks environment for data processing using R, spark and the tidyverse. This message appears even when running an empty command cell.
- Could this be coming from the cluster configuration in Databricks UI? I am loding the following libraries:
# library(sparklyr)
# library(lubridate)
# library(dplyr)
# library(purrr)
# library(httr)
# library(jsonlite)
# library(tidyr)
# library(arrow)
# library(stringr)
# library(DBI)
# library("readxl")
and I use
# if(!require(*library*)){
# install.packages(*"library"*)
# }
Is this something I should worry about with this warning or that I should be checking? I don't understand the warning and could not find the right documentation on google.
CodePudding user response:
Looks to me if some genius package maintainer has masked (~overwritten) something important or uses a (function's) name rather than a character string in do.call
.
You can reproduce the issue like so.
do.call(rbind, list()) ## using the name works as expected
# NULL
Now let's mask rbind
rbind <- 1
do.call(rbind, list()) ## using the name fails
# Error in do.call(rbind, list()) :
# 'what' must be a function or character string
Voilá.
It's safer to use the character string here, which won't fail.
do.call('rbind', list())
# NULL
rm(rbind) ## unmask `rbind`.
The solution is tricky, since you're loading a ton of libraries. You could do the following though:
- Close R-session, if working with RStudio, uncheck Tools > Global Options > General > Restore .RData (maybe the uncheck already solves the issue!)
- Check
Renviron.site
andRenviron.site
files for unusual entries (can be found in the/etc/R/
folder on Linux), alternatively maybe start aR -vanilla
session - Start a fresh R session
- Load each
library
one by one until the error occurs