2

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.

SantosDev
  • 33
  • 3
  • 1
    Yes. You should worry about the warning sufficiently to reassure yourself it is not important. Or to fix it if it is. A piece of code your are running (we can't say what, because you haven't given us anything useful) is calling. `do.call`. `do.call` requires, as the warning suggests, a character or function in its (first) `what` argument. It's not getting it. What it's getting, and whether the difference is important, I cannot say. But best practice would be to fix the problem even if it *apparently* has no consequences. – Limey Apr 19 '22 at 08:58
  • Maybe I did not mention it explicitly, but this warning was coming out of running that code, just loading libraries, even when running only a cell with a comment line, no script. So it seems the issue was with the environment rather than the code – SantosDev Apr 22 '22 at 09:33

2 Answers2

2

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:

  1. Close R-session, if working with RStudio, uncheck Tools > Global Options > General > Restore .RData (maybe the uncheck already solves the issue!)
  2. Check Renviron.site and Renviron.site files for unusual entries (can be found in the /etc/R/ folder on Linux), alternatively maybe start a R -vanilla session
  3. Start a fresh R session
  4. Load each library one by one until the error occurs
jay.sf
  • 60,139
  • 8
  • 53
  • 110
0

This answer is of very limited scope, but wanted to share.

I was getting this error in Databricks as well when I loaded the whole tidyverse, but I don't get it when I just load dplyr and ggplot2.

Maggie
  • 53
  • 5