rrenvr-environment

Using base load in an active renvironment


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?


Solution

  • 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.