Hang PHAN
2008-Jun-09 11:41 UTC
[Rd] Questions about building R extensions from C, data/ and man/, sbml file
Hi, I am building the package in R using>R CMD build -force ./mypackageand check it using>R CMD check ./mypackageHowever I have a problem when running the examples in the manual files. The problem is that I used a specifice type of file that is not table, thus I guess data() can't be use to indicate the use of that particular file in the directory data/. Do you have any idea how I can pass the name of this data file as a string into the arguments of my function e.g. in abc.Rd \Examples{ ss<- abc(fname = "xxx.sbml") } where xxx.sbml is a file in the data/ directory. Again, thanks very much and looking forwards to your reply. Phan Hang [[alternative HTML version deleted]]
Prof Brian Ripley
2008-Jun-09 11:56 UTC
[Rd] Questions about building R extensions from C, data/ and man/, sbml file
Use system.file(). But please don't put your files in the data directory: as the manual says. The data subdirectory is for additional data files the package makes available for loading using data(). So if you put your data files in inst/sbml, your example becomes abc(fname = system.file(package="mypackage", "sbml", "xxx.sbml")) since this will be mypackage/sbml/xxx.sbml when installed. There are several examples on CRAN, e.g. rgdal. On Mon, 9 Jun 2008, Hang PHAN wrote:> Hi, > > I am building the package in R using > >> R CMD build -force ./mypackage > > and check it using > >> R CMD check ./mypackage > > However I have a problem when running the examples in the manual files. The > problem is that I used a specifice type of file that is not table, thus I > guess data() can't be use to indicate the use of that particular file in the > directory data/. Do you have any idea how I can pass the name of this data > file as a string into the arguments of my function > > e.g. in abc.Rd > \Examples{ > ss<- abc(fname = "xxx.sbml") > } > where xxx.sbml is a file in the data/ directory. > > Again, thanks very much and looking forwards to your reply. > > Phan Hang > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595