1

I'm just started using rio to import as have a .tsv file to work with. I'm having the error with multiple files that no such file exists however my working directory is set correctly and I have affirmed this using getwd(). I've done a search online and restarted etc but cannot see what the problem could be.

Working off R version 4.0.3 in RStudio. Is there something stupid I'm missing here?

library(rio) 
library(feather)

install_formats()

transcodeData <- import("Data\transcoding_mesurement.tsv")
zx8754
  • 52,746
  • 12
  • 114
  • 209
Magnetar
  • 85
  • 8

2 Answers2

1

Got working if I have data file in same folder as scripts with code below in case it helps anyone in future. Still can't get it to point outside of that folder successfully

rio::import("transcoding_mesurment.tsv", format = "tsv")

Magnetar
  • 85
  • 8
1

backward slash (\) is a special character in R. either escape \ by using two in a row or use forward slashes to delimit folders.

transcodeData <- import("Data\\transcoding_mesurement.tsv")
transcodeData <- import("Data/transcoding_mesurement.tsv")
Marcelo Avila
  • 2,314
  • 1
  • 14
  • 22
  • Thanks Marcelo, appreciate it – Magnetar Mar 27 '21 at 23:21
  • great :) consider accepting the answer if it solves your issue by clicking at the check mark next to the answer. – Marcelo Avila Mar 28 '21 at 10:41
  • Neither work , on mac OS 10.15. Catalina. The forward slash usually works if I'm not using rio, e.g. with read.csv etc. – Magnetar Mar 28 '21 at 10:48
  • Error: No such file – Magnetar Mar 28 '21 at 14:01
  • Ok... the issue is most likely not related to rio and the import function. you check if a file and folder exists by running `file.exists(Data)`, also you can run `dir()` to show all files and folders in your current working directory. make sure you can find those files there (and that you typed their names correctly. If it does not work, provide in your answer, the output of `dir()` and `dir("Data")`. – Marcelo Avila Mar 28 '21 at 14:50