rread.csvworking-directorysetwd

Read a file in R without changing the working directory


How can others who run my R program read a file(eg: csv) used in my R code without having to change the working directory in setwd()?


Solution

  • I will suggest you use the here() function in the here package in your code like this:

    library(here)
    Data1 <- read_csv(here("test_data.csv"))