I have been using R to interpret antibiotic resistance data i have imported into a data file. the excel file is saved as .csv file. For the first few days everything was running smoothly. today i have tried running the exact same code with no changes to either the working directory or the datafile and been met with the error message :
Error: './data/Amr-staph.csv' does not exist in current working directory ('C:/Users/bevis/OneDrive/R/data')
not too sure how to progress from here as this error message has only appeared today despite the code running yesterday. i have tried creating a new directory with the same data sets but this has not changed anything . any ideas are welcome. all files are stored on my windows laptop. this has happened once before but R restarted and resolved the issue. closing R and opening it again has not helped. sorry for the mishmash of sentences, dissertation is due in 24hrs and am running on little sleep.
code -
install("tidyverse")
library("tidyverse")
setwd("C:/Users/bevis/OneDrive/R/data")
AMR <- read_csv("./data/Amr-staph.csv")
You are telling R to look for ".../R/data/data/Amr-staph.csv". Either remove "/data" from the last line or from the next to last line.
Here is my solution.
filepath_import <- r"(C:\Users\user\...\imported data)"
filename <- paste0(filepath_import, "/", "file name", ".csv")
read.csv(filename)
This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.