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
9
votes
0 answers

How could I release an R package on github using github submodules?

I have an R package on github. This R package has C++ dependencies which I include in /src. The correct way I would normally do this (outside of R) is create submodules within the github repo, which could link to the correct commits as…
ShanZhengYang
  • 16,511
  • 49
  • 132
  • 234
9
votes
2 answers

What is the best practice for making functions in my R package parallelizable?

I have developed an R package that contains embarassingly parallel functions. I would like to implement parallelization for these functions in a way that is transparent to the user, regardless of his/her OS (at least ideally). I have looked around…
C8H10N4O2
  • 18,312
  • 8
  • 98
  • 134
9
votes
2 answers

R code in package vignette cannot run on CRAN for security reasons. How to manage such vignette?

An R package communicates with a commercial data base using a private user_name and password to establish connection. In the package_vignette.Rmd file there is a chunk of code: ```{r, eval = TRUE} # set user_name and password from user's…
8
votes
1 answer

Issues compiling Rpackage: error in asNamespace(ns) using Rcpp

Working on a small Rcpp package to use Boost and some of its geometry functions in C. Finished writing the functions and everything was working well. Tested that everything was working properly (Clean and Rebuild and testing the functions) one last…
er.gt
  • 109
  • 5
8
votes
1 answer

"failed to find package directory" error on Travis-CI while computing code coverage

I am no longer getting code coverage for R package using covr on Travis (e.g., this build) and it gives the following error: Travis never encountered any issues before, as can be seen from the following commits log and suddenly it stopped…
Indrajeet Patil
  • 4,673
  • 2
  • 20
  • 51
8
votes
2 answers

How to profile the loading of an R package

I have written this R package that takes ages (> 10s, sometimes up to 20-30s!) to load. Every time the package loads, such as when building the package at the step "** testing if installed package can be loaded", or directly calling…
asachet
  • 6,620
  • 2
  • 30
  • 74
8
votes
1 answer

R package: writing internal data, but not all at once

I'm working on an R package using usethis/devtools. The package has a few objects I'd like to keep internal, just to keep down the clutter. The structure I was using was to make objects in different files based on their source, all in my data-raw…
camille
  • 16,432
  • 18
  • 38
  • 60
8
votes
1 answer

Error in browseVignettes: no vignettes found

I'm trying to see the vignette that I've created after rebuilding a package on my local computer. Note that this has nothing to do with suggestions on this post, since I'm not cloning from Github. The vignettes portion of my vignette file looks…
matsuo_basho
  • 2,833
  • 8
  • 26
  • 47
8
votes
1 answer

R package build failing on Unix machines due to missing GSL - GNU Scientific Library

I am facing a particularly vexing problem with R package development. My own package, called ggstatsplot (https://github.com/IndrajeetPatil/ggstatsplot), depends on userfriendlyscience, which depends on another package called MBESS, which itself…
Indrajeet Patil
  • 4,673
  • 2
  • 20
  • 51
8
votes
2 answers

Renaming and Hiding an Exported Rcpp function in an R Package

Writing an R package, I have a R function that calls a specific Rcpp function. The Rcpp function just serves as a helper function and I do not want to creat a .Rd file for it. My solution so far is to export both functions in the Namespace file…
Cello
  • 91
  • 4
8
votes
3 answers

Problems with installation R packages

I'm a Windows user. A few weeks ago I installed R and Rstudio along with many packages. Today there was a message that new packages were not installed. Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib: …
AntonCH
  • 272
  • 2
  • 3
  • 13
8
votes
1 answer

Requiring OpenMP availability for use in an Rcpp package

I have prepared a package in R by using RcppArmadillo and OpenMP libraries and following commands: RcppArmadillo.package.skeleton("mypackage") compileAttributes(verbose=TRUE) Also, in the DESCRIPTION file I added: Imports: Rcpp (>= 0.12.8),…
Ham82
  • 665
  • 1
  • 4
  • 16
8
votes
2 answers

defining custom dplyr methods in R package

I have a package with custom summary(), print() methods for objects that have a particular class. This package also uses the wonderful dplyr package for data manipulation - and I expect my users to write scripts that use both my package and…
Andrew
  • 9,090
  • 8
  • 46
  • 59
8
votes
2 answers

Are explicit roxygen import from base package needed?

Concrete example: In my package, one of my functions uses grep form the base package. Should I explicitly import grep or would that just introduce useless dependencies? I mean, everyone already has the base package, right? For the sake of…
asachet
  • 6,620
  • 2
  • 30
  • 74
8
votes
1 answer

Rendering an .Rmd fails because stringr.rdb is corrupt?

When I render a vignette with rmarkdown::render('/path/to/pkg/vignettes/my-vignette.Rmd') I encounter the error processing file: draft-vignette.Rmd Error in get0(oNam, envir = ns) : lazy-load database…
Konstantinos
  • 4,096
  • 3
  • 19
  • 28