i am creating a package in R language, everything is running properly, but when i run R CMD check , it shows an error message while running examples.. i.e. "can't open the file." "No such file or directory" actually my function needs a PubMed text file containing abstracts from the PubMed, i have placed my text file in every sub-directory of my package, but its not working. showing same error again and again. so please suggest me the right way how to put a text file in a package which can be used by examples to run properly. i will be very thankful to you.
Asked
Active
Viewed 138 times
2 Answers
1
Usually you put such data in the /inst folder. E.g.:
<packageRoot>/inst/pubmed/myfile
After the package is build you can access the content of this folder from within the package like this:
system.file( "pubmed/myfile", package="<package>" )
See for more information http://cran.r-project.org/doc/manuals/r-release/R-exts.pdf (1.1.5 Data in packages).

Beasterfield
- 7,023
- 2
- 38
- 47
-
@JyotiSharma As a regular reminder: Let me know if something is still unclear or parts of your question are still answered. But if your question is entirely answered, it'd be nice if you'd accept the answer by clicking the check mark. – Beasterfield May 17 '13 at 09:33
0
I suggest you to use devtools and roxygen2 packages. Basically, you just need to prepare description and .R files.
see more details in this brilliant answer :devtools roxygen package creation and rd documentation