Questions tagged [r-package]

This tag should be used for questions regarding the development of R packages. Do not use this tag to ask questions about the use of R packages. Many common R packages have their own tags for that purpose.

This tag should be used for questions regarding the development of R packages. Do not use this tag to ask questions about the use of R packages. Many common R packages have their own tags for that purpose.

The R Core Team defines a package in the Manual on Writing R Extensions:

A package is a directory of files which extend R, a source package (the master files of a package), or a tarball containing the files of a source package, or an installed package, the result of running R CMD INSTALL on a source package. On some platforms (notably OS X and Windows) there are also binary packages, a zip file or tarball containing the files of an installed package which can be unpacked rather than installing from sources.

1279 questions
70
votes
3 answers

checking CRAN incoming feasibility ... NOTE Maintainer

When I run R CMD check --as-cran on my package, the one note I still get is: checking CRAN incoming feasibility ... NOTE Maintainer:[my name] I can't seem to find a good explanation of this note, although I haven't read anything that…
Benjamin
  • 16,897
  • 6
  • 45
  • 65
70
votes
4 answers

How to load packages in R automatically?

Could you suggest me a way for loading packages in R automatically? I mean, I want to start a session in R without needing to use library('package name') several times. Suppose I downloaded all packages I'll want to use the next time I start R.
nhern121
  • 3,831
  • 6
  • 27
  • 40
65
votes
3 answers

How can I document data sets with roxygen?

Is it possible to include .R files in the data directory of my package in the roxygen process? I have put several .R files in the data directory. When they are sourced with data(), they read in raw data files and perform some transformations.
Karsten W.
  • 17,826
  • 11
  • 69
  • 103
49
votes
4 answers

Creating a local R package repository

I would like to create a local R package repository such that users in my company can install packages from it and the system admins can update the local repo periodically. Access to the CRAN mirrors is currently denied. Is there a simple way to do…
harshsinghal
  • 3,720
  • 8
  • 35
  • 32
44
votes
2 answers

R: How to run some code on load of package?

I am learning to build a package for R. Now to set it up I need to run some code when the package is being loaded via require(myPackage). I read the documentation on help(".onLoad") that just made me really confused as there is no example. How do I…
xiaodai
  • 14,889
  • 18
  • 76
  • 140
40
votes
3 answers

Add objects to package namespace

I'd like to push a function inside a package namespace so it can access internal objects of that package (let's use stats package as an example). I've tried using myfun <- function(x) print(x) env = loadNamespace("stats") assign("myfun", myfun ,…
Etienne Racine
  • 1,323
  • 1
  • 11
  • 25
32
votes
3 answers

Which is the correct folder to store images used in vignettes for R packages ?

I am writing a vignette for my R package. I want to include a .jpg image on the .Rmd file that will generate the pdf vignette. The question is: where should I store this image? I am using the packages devtools and knitr to generate vignettes…
Gustavo B Paterno
  • 976
  • 1
  • 9
  • 14
29
votes
1 answer

Non-standard file/directory found at top level: 'README.Rmd' persists even after implementing suggested solutions

I am working on a package and running R CMD CHECK on it using devtools::check() produces the following NOTE: > checking top-level files ... NOTE Non-standard file/directory found at top level: 'README.Rmd' A variant of this question has been…
Indrajeet Patil
  • 4,673
  • 2
  • 20
  • 51
25
votes
2 answers

accessing sysdata.rda within package functions

I thought that putting an internal dataset for a package into R/sysdata.rda would make the data accessible to my functions. But I can't seem to figure out how to actually access this dataframe. None of the documentation actually says how to access…
Mark Danese
  • 2,331
  • 1
  • 20
  • 25
23
votes
4 answers

Show names of everything in a package

Is there an easy way to list everything in a package from within R? For example, if I type foreach::: and hit tab twice, I can see everything that's there. How else can I get those names of objects? Note, ls("package:foreach", all.names=TRUE) does…
GSee
  • 48,880
  • 13
  • 125
  • 145
20
votes
3 answers

Configuring compilers on Apple silicon (Big Sur, Monterey, Ventura) for Rcpp and other tools

I'm trying to use packages that require Rcpp in R on my M1 Mac, which I was never able to get up and running after purchasing this computer. I updated it to Monterey in the hope that this would fix some installation issues but it hasn't. I tried…
AFH
  • 665
  • 1
  • 9
  • 28
20
votes
3 answers

'LazyData' is specified without a 'data' directory error when submitting R package to CRAN

When I run devtools::check on my package locally, I don't get this error, but when I submit my package to CRAN, or when I run devtools::check_win_devel, I get this error: 'LazyData' is specified without a 'data' directory I successfully submitted…
s460
  • 467
  • 2
  • 9
20
votes
2 answers

Package Development: Multiple files or Single File

I've been poking through a bunch of different packages and I'm noticing that there really isn't a clear and concise method for function storage. Some package authors pack all of them in one file while other authors split them into individual files.…
Brandon Bertelsen
  • 43,807
  • 34
  • 160
  • 255
18
votes
2 answers

Gitignore man directory of an R package?

Because each and every file in the man/ directory of an R package is automatically written with package roxygen2, I wonder what would prevent me from adding the entire directory to my .gitignore. In other words, why all R packages on GitHub still…
F. Privé
  • 11,423
  • 2
  • 27
  • 78
18
votes
3 answers

Include non-CRAN package in CRAN package

The question is pretty simple. First: Is it possible to include a non-CRAN (or bioconductor, or omega hat) package in a CRAN package and actually use tools from that package in examples. If yes how does one set up the DESCRIPTION file etc. to…
Tyler Rinker
  • 108,132
  • 65
  • 322
  • 519
1
2 3
85 86