0

I am working on an R markdown notebook in an active renv in my R project directory. Before I had activated the environment, I could use the load function from base R without a problem. But since activating the environment, I get errors when I use load(file=abc.RData).

I have a code chunk as follows:

rm(list=ls())

library(haven)
library(dplyr)
library(data.table)

# Load complete (individual+network) data ---------------------------
load(file="/Volumes/caas/CADRE CLC Data Project5/Clean Data/AK-SU-NETWORKS-ROUT/eda.RData") 

If I try to run the chunk, I get the following error:

Error in load(file = "/Volumes/caas/CADRE CLC Data Project5/Clean Data/AK-SU-NETWORKS-ROUT/eda.RData") : 
  unused argument (file = "/Volumes/caas/CADRE CLC Data Project5/Clean Data/AK-SU-NETWORKS-ROUT/eda.RData")

But if I knit the document, it compiles without a problem.

What might I be doing wrong?

1 Answers1

0

It looks like all I had to do was specify that I wanted to use load from base, as:

base::load(file="/Volumes/caas/CADRE CLC Data Project5/Clean Data/AK-SU-NETWORKS-ROUT/eda.RData") 

That seems to have fixed it.

  • Your solution indicates that there was another function named `load()` that was masking the one in base. It would be helpful for others if you explained which package that came from (or if it was your own function in the environment). – user2554330 Nov 28 '22 at 21:27