course-starter-r icon indicating copy to clipboard operation
course-starter-r copied to clipboard

/data folder doesn't seem to work

Open joseph-allen opened this issue 3 years ago • 2 comments

When I add a data folder as I've done here -> https://github.com/UKDataServiceOpen/r-course-starter/tree/master/data

running

# test read in the dataset from /data/test.txt
df <- read.table('data/test.txt', header = FALSE)

causes

Warning message in file(file, "rt"):
“cannot open file 'data/test.txt': No such file or directory”
Error in file(file, "rt"): cannot open the connection
Traceback:

1. read.table("data/test.txt", header = FALSE)
2. file(file, "rt")

meanwhile

# read from web hosted files
df <- read.table("https://s3.amazonaws.com/assets.datacamp.com/blog_assets/test.txt", 
                 header = FALSE)

works

joseph-allen avatar Jul 28 '21 16:07 joseph-allen

I've tried it with a .csv and it does work, I am guessing somewhere only .csvs are allowed through as datasets but this wasn't clear in the docs.

Thanks anyway Ines!

joseph-allen avatar Jul 28 '21 17:07 joseph-allen

looking at this again I need to load in SPSS .sav files too, so I might have to convert it to .CSV and lose some benefit in this process.

joseph-allen avatar Aug 05 '21 20:08 joseph-allen