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

Package dependencies for R base packages

When writing a package in R, is it necessary to add base packages (utils, grDevices, stats, etc.) as dependencies in the DESCRIPTION of your package? Some packages do this, but most seem to not. I have not found any information in the Writing R…
Johan Larsson
  • 3,496
  • 18
  • 34
8
votes
1 answer

Include errors in R markdown package vignette

I'm developing an R package and have a custom function which contains a if(condition) stop("Error message") conditional. I call this function in a package vignette with the intention of generating the error message and including that in the…
user3713498
8
votes
2 answers

Best practices to alert users of package vignettes when `library(packagename)` is loaded?

I'm writing an R package and spend lots of time on the documentation vignettes. I'm wondering if i should add something like .onAttach <- function( libname , pkgname ){ packageStartupMessage("use `browseVignettes('packagename')` to see…
Anthony Damico
  • 5,779
  • 7
  • 46
  • 77
8
votes
0 answers

R create reference manual with R CMD rd2pdf

I am creating a R package and want to make a pdf manual with it. I was using rd2pdf command for this. I have written R CMD Rd2pdf "C:/Users/razrahma/Documents/RPackage/mypackage" in the console. But it is showing Error: unexpected symbol in "R…
RaziB
  • 91
  • 1
  • 3
8
votes
3 answers

Add sections to R package's help/documentation

Some R packages (e.g., ggplot2, dplyr,devtools etc.) have alphabetically entitled sections in their help/documentation and a bar of links to those sections (indicated by red arrows in picture below). Other packages (e.g., RcmdrMisc) don't have. …
GegznaV
  • 4,938
  • 4
  • 23
  • 43
8
votes
2 answers

Package unavailable in package build after R update using packrat

I recently updated to R 3.1.3 and I am building a package using RStudio and packrat. I am trying to re-build my package using RStudio's in built "Build and Reload" tool, but it won't work. I keep receiving the following error: Updating standaRd…
nathaneastwood
  • 3,664
  • 24
  • 41
8
votes
2 answers

List of packages that need an update

How can I produce a list of packages that need an update, i.e. a table with package name, version currently installed and version available at the repository? I have tried to hack packageStatus(), installed.packages(), update.packages() but I am not…
Tomas
  • 57,621
  • 49
  • 238
  • 373
7
votes
1 answer

Using inst/extdata with vignette during package checking R 2.14.0

I have a package which contains a csv file which I put in inst/extdata per R-exts. This file is needed for the vignette. If I Sweave the vignette directly, all works well. When I run R --vanilla CMD check however, the check process can't find the…
Bryan Hanson
  • 6,055
  • 4
  • 41
  • 78
7
votes
1 answer

R package long time to install - Source or Binary type

Am trying to install a package called stringi using the below command install.packages("stringi") Though it doesn't throw any error message but the installation is not over yet. I see lot of messages in my console screen which keeps running for more…
The Great
  • 7,215
  • 7
  • 40
  • 128
7
votes
2 answers

Can't install `proj4` package because libproj and/or proj_api.h not found in standard search locations

I want to install ggalt package which needs proj4 package installed, but when I install proj4 it throws an error libproj and/or proj_api.h not found in standard search locations. My computer is Mac, and I have installed PROJ.4 using brew install…
juby
  • 132
  • 1
  • 5
7
votes
0 answers

Listing database tables for sqlite in R

I am unable to list tables for the sqlite database I am connecting to from R. I setup the tables in my database (WBS_test1.db) using "DB Browser" https://sqlitebrowser.org/ Looking at this db in the command window, I am able to list the tables via…
dphuber
  • 71
  • 1
  • 3
7
votes
1 answer

R package building: How to import a function from a package not on CRAN

Problem I am trying to import a function from a non-CRAN repo into my package. I know R searches CRAN for any package declared in the Imports: field of the DESCRIPTION file. Is there any way to, for example, import function from package…
mc-sq
  • 169
  • 1
  • 9
7
votes
0 answers

R package DESCRIPTION - Remotes from Bioconductor should install binary

I am working on an R package (https://github.com/bgbrink/dropClust) and I was testing if it can be installed, since it depends on a number of packages both from CRAN and from Bioconductor. I specified the three dependencies from Bioconductor in the…
bgbrink
  • 643
  • 1
  • 6
  • 23
7
votes
1 answer

Test interaction with users in R package

I am developing an R package and one of the function implements interaction with users through standard input via readline. I now wonder how to test the behavior of this function, preferably with testthat library. It seems test_that function…
Kota Mori
  • 6,510
  • 1
  • 21
  • 25
7
votes
2 answers

Using RStudio's "Build" but no *.Rcheck generated

I've just started using RStudio's build check, and used it to make one package already. I've started on a second package, and this one is failing. As the build attempt happens, I get updates like: * checking whether package ‘< package >’ can be…
gruvn
  • 692
  • 1
  • 6
  • 25