Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of : Warning in do.call(.f, args, envir = .env) : "what" must be a function or character string

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.

like image 228
SantosDev Avatar asked Nov 06 '25 12:11

SantosDev


2 Answers

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
like image 177
jay.sf Avatar answered Nov 09 '25 02:11

jay.sf


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.

like image 29
Maggie Avatar answered Nov 09 '25 02:11

Maggie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!