0

I'm trying to create a R notebook file, and I get stuck right in the beginning of my code, when trying to read the .csv file. I have a first chunk, all good at this point:

library(readr)

But then I try to load my data with:

my_data <- read_csv2(".Data/my_data_2021-06-29.csv")

and I get the following error:

/bin/sh: load: command not found

Same error with read_csv(), read.csv() and readr::read_csv(). All works fine in RStudio, but not in the .Rmd file.

I'm working on a Mac, with macOS Catalina 10.15.7, R version 4.0.5, RStudio version 10.4.1106, and I also updated all my packages with Tools > Check for Package Updates…

Does anyone know how to solve this? I saw similar questions here and here, but they were about using functions in other situations (anaconda and command line), and I saw no solution for this one.

Many thanks

Phil
  • 7,287
  • 3
  • 36
  • 66
MKob
  • 1

1 Answers1

0

I realised it was my mistake when writing the code.
Here are the details in case someone does the same.

Usually the code chunk starts with a line where, among other parameters, the code language is set:

{r, echo = F}
my_data <- read_csv2(".Data/my-data_2021-06-29.csv")

And I edited this line, thinking I was giving the chunk a title, but I was erasing the language it is supposed to be read, therefore the error output I was having:

{load data, echo = F}
my_data <- read_csv2(".Data/my-data_2021-06-29.csv")

So the correct form is the first one.

MKob
  • 1