I'm having issues reading the data on the desktop version of Rstudio on mac. When I do the usual read.csv it shows the error shown in the title. This is the first time this has happened. I have tried to change my working directory in 'Sessions' at the top and also to read the file with its granularity
Asked
Active
Viewed 1,607 times
0
-
1Welcome to SO! Please don't show error messages or code as images, but put it into you question as text and provide a [MRE](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example), thanks! You have a space at the end of your path, maybe this is the problem? In general, I would avoid spaces in path names – starja Dec 28 '20 at 22:35
-
The folder name includes a space at the end `Titanic Kaggle `. Try updating your read.csv line to include that space. Additionally, when the working directory is set you can specify a 'relative' path. This means that you should be able to just run `read.csv("test.csv")` after setting your working directory successfully. – Lief Esbenshade Dec 28 '20 at 22:38
-
Keep your csv file in the same directory as your markdown document. So you can directly do `Test = read.csv("test.csv")` – Ronak Shah Dec 29 '20 at 03:47
1 Answers
0
You could try rstudioapi
library to set an unique wd for your script path and then use read.csv()
where path= "test.csv"
library(rstudioapi)
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
Test <- read.csv("test.csv")

AlSub
- 1,384
- 1
- 14
- 33