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

Compiling C++ in Rcpp with external C library

I am trying to build an R package with Rcpp code which uses an external library. I had previously asked SO about how to use an external C library in a package here. The problem I have facing is as soon as I include the following line of code y =…
Satya
  • 1,708
  • 1
  • 15
  • 39
7
votes
2 answers

Why will this R package not install and how can I fix it?

I would like to include a Fortran subroutine in an R package. I have always only built packages using devtools and roxygen (so my knowledge may be pretty limited). I am getting an error that prevents me from the package getting installed after it…
statsNoob
  • 1,325
  • 5
  • 18
  • 36
7
votes
0 answers

R packages built under r-devel version?

I was loading AIMS package and got a warning: package ‘AIMS’ was built under R version 3.2.0 I thought R-3.1.2 ("Pumpkin Helmet") was the latest release so I checked on CRAN and couldn't see anything about a R-3.2.0. Before calling it a typo, I…
Cath
  • 23,906
  • 5
  • 52
  • 86
7
votes
1 answer

Check for installed packages in R

Based on the answer to this question: Elegant way to check for missing packages and install them? I'm using the following code to make sure that all packages are installed when I upgrade R, or set up other users: list.of.packages <- c("RODBC",…
sinclairjesse
  • 1,585
  • 4
  • 17
  • 29
7
votes
0 answers

Determine number of package downloads

This may not be the appropriate place for this question as this site is more of a coding site but this also seems the most appropriate place for the question compared to the alternatives. Is there a way to determine how many times an R package has…
Tyler Rinker
  • 108,132
  • 65
  • 322
  • 519
6
votes
3 answers

R package submission error concerning set.seed()

I recently submitted a package to CRAN that passed all the automatic checks, but failed passing the manual ones. One of the errors were the following: Please do not set a seed to a specific number within a function. Please do not modifiy the…
Carl
  • 301
  • 2
  • 10
6
votes
0 answers

What are some use cases for assignInMyNamespace?

I would like to know of some packages that make use of assignInMyNamespace and what it's used for, if it is even advisable to use this function in production code. The help page gives the following information: assignInMyNamespace is intended to be…
wurli
  • 2,314
  • 10
  • 17
6
votes
0 answers

Using clang to compile R packages on Windows

I've developing R packages that contain C++ code on Windows 10. I wish to check for memory allocation errors. It sounds like the simplest path is to use clang++ with the -fsanitize=address option. How do I configure R such that clang is the default…
Martin Smith
  • 3,687
  • 1
  • 24
  • 51
6
votes
2 answers

R package declaring author in DESCRIPTION

My DESCRIPTION file looks like this (showing only relevant part). Author: John Doe Authors@R: person("John", "Doe", email = "john.doe@email.com",role = c("aut", "cre")) Maintainer: John Doe devtools::check(), R CMD check and R…
mindlessgreen
  • 11,059
  • 16
  • 68
  • 113
6
votes
1 answer

Compacting Shared Libraries in R package

My package .so file is above 3 MB (up to 10 MB) depending of the compiler and the system. This generates a NOTE with R CMD check in my package for years. My package does not contain so much code so I eventually searched to reduce the size and I…
JRR
  • 3,024
  • 2
  • 13
  • 37
6
votes
1 answer

How to use rlang operators in a package?

I am writing a package that uses tidyverse functions, i.e. that use non-standard evaluation, like dplyr::filter for example: setMethod("filter_by_id", signature(x = "studies", id = "character"), definition = function(x, id) { …
Ramiro Magno
  • 3,085
  • 15
  • 30
6
votes
2 answers

Namespaces in Imports field not imported from: All declared Imports should be used

I am working on my R package. I am getting this error: Namespaces in Imports field not imported from: ‘kableExtra’ ‘ranger’ All declared Imports should be used. I get this error with devtools::check_rhub() i.e. on linux and windows platform.…
YOLO
  • 20,181
  • 5
  • 20
  • 40
6
votes
1 answer

Check if package is installed without loading

The typical way a package developer is advised to check whether a user has installed a package is like this: if (!requireNamespace("package")) { stop("Please install package.") } requireNamespace loads the package (in the current scope?) and…
commscho
  • 380
  • 2
  • 7
6
votes
1 answer

Fortran subroutine not available for R package

An old project of mine has started showing a new behavior, a fortran subroutine that has been available for use by the R package no longer available. The package has both C++ and Fortran code in the src/ directory. Apparently the C++ methods are…
Peter
  • 7,460
  • 2
  • 47
  • 68
6
votes
2 answers

Stuck with definition of S3 method for autoplot

I'm stuck with defining S3 method for autoplot. I have the following (full code here): #' Autoplot for bigobenchmark object #' #' @importFrom ggplot2 autoplot #' #' @param object #' #' @return A ggplot2 plot #' @export #' #' @examples #' # Create…
m0nhawk
  • 22,980
  • 9
  • 45
  • 73