Hello, I am creating a package and in my vignette I would like to load a text file from the data folder of the package. Currently, I am doing the following: filepath <- paste(.libPaths(), "pkgname", "data", "sample.txt", sep = "/") file(filepath) Is there a better way of doing this? Thanks, Andrew
Henrique Dallazuanna
2010-Jul-07 13:32 UTC
[R] Loading text file from data folder of package
See ?system.file On Wed, Jul 7, 2010 at 10:20 AM, Andrew Liu <Andrew.T.Liu@williams.edu>wrote:> Hello, > > I am creating a package and in my vignette I would like to load a text file > from the data folder of the package. Currently, I am doing the following: > > filepath <- paste(.libPaths(), "pkgname", "data", "sample.txt", sep = "/") > file(filepath) > > Is there a better way of doing this? > > Thanks, > Andrew > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]