0
votes

I am developing an R package and some funcions need to read an static .csv file inside the package, using read.csv function.

I red some text about this

http://r-pkgs.had.co.nz/data.html

http://tinyheero.github.io/jekyll/update/2015/07/26/making-your-first-R-package.html

They recommend to save the files in inst/extdata. But I still didnt get it. inst/extdata is a folder inside my package? Because I want my functions read the .csv file using the read.csv function, not the system.file function

Some help here would be nice

1

1 Answers

1
votes

system.file() provides the path to the file in the package. If I want to pull data from a csv file that's included in a package, I can use:

data <- system.file("extdata", "datafile.csv", package = "mypackagename")
data_df <- read.csv(data)