1

I am trying to import .csv files into R to make line graphs with using ggplot2. I am editing a code that has worked previously, but now only works for some of the files (i.e. 7 of 10 files are accessed fine by R, but 3 are not). All the files are in the same format, formatted the same within the csv and in the same directory. Attached the relevant bit of code.

In this example file 4 is fine, but 5 and 6 return the errors "Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file '/Users/abbie/Desktop/uni_work/2018_11_21/ABS_Zn_QAH': No such file or directory"

Any ideas? TIA

library(ggplot2)
file4 <- read.csv(file = "/Users/abbie/Desktop/uni_work/2018_11_21/ABS_AH.csv",
              header = TRUE)

file5 <- read.csv(file = "/Users/abbie/Desktop/uni_work/2018_11_21/ABS_Q_AH",
              header = TRUE)

file6 <- read.csv(file = "/Users/abbie/Desktop/uni_work/2018_11_21/ABS_Zn_QAH",
              header = TRUE)
markus
  • 25,843
  • 5
  • 39
  • 58
Abbie
  • 11
  • 3
  • 1
    file 5 and file 6 have no file type specified (*.csv is missing). Could that already fix the problem? – Mojoesque Dec 03 '18 at 15:35
  • @Abbie: better way would be to list all the files having certain extension then read them into 1 single data frame e.g. https://stackoverflow.com/a/48105838/786542 – Tung Dec 04 '18 at 05:31

0 Answers0