r - Using read_csv with path to a file (readr's package) -
i face difficulty in trying read csv file read_csv
function readr
package using file's path.
my file ("test.csv") located in 'data' folder.
data folder located @ root of project (working directory)
wd <- getwd() data_path <- "data" file.exists(file.path(wd, data_path, "test.csv")) # returns true library(readr) data.1 <- read_csv(file = file.path(wd, data_path, "test.csv")) # not work
the log provides me following error:
error in withcallinghandlers(expr, warning = function(w) invokerestart("mufflewarning")) : argument "x" missing, no default
however works standard read.csv
function
data.1 <- read.csv("data/mockup_data_v1.csv", header = true, sep = ",") # ok
could please let me know how proceed use read_csv
readr
package file path argument?
as you've set working directory, should able read file with:
data.1 <- read_csv("data/test.csv")
because r looks in working directory default, in effect asking r in:
working directory/working directory/data/test.csv
Comments
Post a Comment