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
5
votes
1 answer

Use function from a package but different versions simultaneously

I have a multiple versions of the same package foo (all with one function bar), that I all want to use in the same script. Following this question, I can load v1 of the package with library("foo", lib.loc = "pkgs/v1"). But this loads all of the…
David
  • 9,216
  • 4
  • 45
  • 78
5
votes
1 answer

Warning: LazyData DB of .... MB without LazyDataCompression set

I have run devtools::check() on my R package and obtained the following error: LazyData DB of 14.3 MB without LazyDataCompression set One of the suggested solutions to this problem is to delete LazyData:true from the description file. However, I…
5
votes
1 answer

R package design: how to export internal functions to a cluster

I'm working on an R package, and I need to run a function myfun on a cluster using parallel::parLapply. myfun calls several additional functions from my package, which in turn call more functions, some of which have multiple methods... so passing…
Jacob Socolar
  • 1,172
  • 1
  • 9
  • 23
5
votes
1 answer

renv::restore() error: failed to retrieve 'package' (using private package)

I am intending to use the renv package in R to set up a global cache on a linux server, where other users would be able to: i) use the packages by creating symlinks to the renv library I created (and therefore save on memory and time by not…
M M
  • 429
  • 5
  • 13
5
votes
3 answers

how to attach a package including the non-exported functions?

When debugging functions from an external package, I often find myself copying the function to a new script to add my corrections, but I have to add a bunch of foo=extpack:::foo at the beginning of the script for the function to access the internal…
Dan Chaltiel
  • 7,811
  • 5
  • 47
  • 92
5
votes
3 answers

Not able to install V8 package on ubuntu?

I am trying to install V8 package on ubuntu but i am getting below error: Warning in install.packages : installation of package ‘V8’ had non-zero exit status Any help would be appreciated! :)
Nick
  • 333
  • 5
  • 17
5
votes
2 answers

S4 exports specified in 'NAMESPACE' but not defined in package

I just finished some minor updates to an R package I've had on CRAN for a few years (haven't had to update in a while). My package passes Check on my local machine and on winbuilder, but it just bounced back from CRAN with the message checking…
Matt Tyers
  • 2,125
  • 1
  • 14
  • 23
5
votes
1 answer

Correct format for input of License into DESCRIPTION document of own R package

So I'm writing an R package. Part of the essential documentation is the DESCRIPTION file. In this DESCRIPTION file there is a line where one must specify the Licensing of the package for CRAN-sharability purposes. I've tried inputting the license in…
Momchill
  • 417
  • 6
  • 15
5
votes
1 answer

R-devel with sanitizer from rocker

I'm trying to install R devel with ASAN USBAN from rocker. Following the README I tried: sudo docker run --rm -ti rocker/r-devel-san This took a long time to download but at the end it was ok. Then I installed the sanitizers package to test R…
JRR
  • 3,024
  • 2
  • 13
  • 37
5
votes
2 answers

How to memoise a function at package startup in R

I work on an R package which wraps API calls. In order to reduce the number of actual calls and to speed things up, I memoise the function making the API call. To do so, I created the following function, which allows to set the cache…
der_grund
  • 1,898
  • 20
  • 36
5
votes
1 answer

devtools Error in read.dcf(path_desc) : Line starting 'This corresponds to ...' is malformed

I've spent long enough on this problem that I thought I'd make a post about it. Using devtools to develop R packages is really a must. I generated my new package with the usual command : usethis::create_package(proj_path) Then I started working…
RoB
  • 1,833
  • 11
  • 23
5
votes
3 answers

How to create .Rproj inside of a folder where an R package/project lives?

So I have an R package/project inside of a folder. This package/project was created without the .Rproj file. How do I retroactively go back to create that file for that package/project?
5
votes
1 answer

Where do I specify random seed for tests in R package?

I am using testthat to write tests for my R package. One of my tests makes use of jitter. I want to make sure the test is reproducible. Do I put set.seed(1014) Before or after library(testthat) in ./tests/testthat.R; or At the top of each test file…
robust
  • 594
  • 5
  • 17
5
votes
1 answer

Why does Rcpp function segfault only when called from R package but not when sourced directly via sourceCpp?

I have a C++ function that works in R when sourced independently using Rcpp, but when I include it in a compiled R package, I keep receiving the following error: error: arma::memory::acquire(): out of memory. In this post, I have provided the C++…
5
votes
1 answer

Reproducible saveRDS with environments

I am building an R package and using data-raw and data to store a library of pre-defined RxODE models. This works very well. However, the resulting .rda files change at every generation. Some models contain an R environment, and the serialization…
parasietje
  • 1,529
  • 8
  • 36