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
18
votes
4 answers

Search for packages by a particular author

Sometimes I get accustomed to a particular R package's design and want to search CRAN for all packages by that author (let's use Hadley Wickham for instance). How can I do such a search (I'd like to use R but this doesn't have to be the mode of…
Tyler Rinker
  • 108,132
  • 65
  • 322
  • 519
17
votes
5 answers

R check warning: Files in the 'vignettes' directory but no files in 'inst/doc'

Lately I get a warning for my vignette on Win R Development Version when doing a cran check. Files in the 'vignettes' directory but no files in 'inst/doc' This warning only appears with the Win Dev version. For Mac, AppVeyor and Travis no warning…
Steffen Moritz
  • 7,277
  • 11
  • 36
  • 55
17
votes
1 answer

raise a NOTE exception during R CMD check

Is there any way I could raise my own NOTE exception from within the unit tests in the checking tests ... step of R CMD check? In general I would like to have a NOTE in 00check.log if database was not available during unit tests. Dirty solutions…
jangorecki
  • 16,384
  • 4
  • 79
  • 160
17
votes
1 answer

R Calling internal function from an exported function inside package

I am creating an R package in RStudio. Say I have two functions fnbig() and fnsmall() in my package named foo. fnbig() is a function that must be accessible to the user using the package. fnsmall() is an internal function that must not accessible to…
mindlessgreen
  • 11,059
  • 16
  • 68
  • 113
17
votes
2 answers

Masking methods in R

This question and in particular this answer brought up the following question: How can I get a warning about the masking of methods in R? If you run the following code in a clean R session, you'll notice that loading dplyr changes the default…
shadow
  • 21,823
  • 4
  • 63
  • 77
16
votes
2 answers

Error : "sh: gfortran: command not found" | Ubuntu 16.04

I am trying to install package , circular, I get the below error during the installation. I tried a few option that were suggested in a few posts but it didn't work. I also tried loading other packages such as spatstat and this error doesn't occur…
RBK
  • 375
  • 2
  • 5
  • 12
16
votes
1 answer

The use of quotation marks when loading a package in R

Is there any reason to prefer the use of quotation marks when loading a package; e.g. library("MASS") over loading packages without putting the name in quotes; library(MASS) Looking back at some old code, I seem to switch between the two with no…
guyabel
  • 8,014
  • 6
  • 57
  • 86
15
votes
2 answers

How to make variable available to namespace at loading time

In one of my packages I use the .onAttach hook to run some R code and then use assign to make the value available as one of the package variables. I do it because variable depends on the content of some file, which can change between one session and…
lucacerone
  • 9,859
  • 13
  • 52
  • 80
15
votes
2 answers

Transferring maintainership of an R package on CRAN

I will be taking over the active development and maintaining of an R package on CRAN (of course with approval of the current maintainer). What are the necessary steps to make this happen / Should we proceed as follows?: (I assume only the current…
user3825755
  • 883
  • 2
  • 10
  • 29
15
votes
1 answer

How to use S3 methods from another package which uses export rather than S3method in its namespace without using Depends or library()

I'm working on an R package at present and trying to follow the best practice guidelines provided by Hadley Wickham at http://r-pkgs.had.co.nz. As part of this, I'm aiming to have all of the package dependencies within the Imports section of the…
Nick Kennedy
  • 12,510
  • 2
  • 30
  • 52
15
votes
4 answers

How to put datasets into an R package

I am creating my own R package and I was wondering what are the possible methods that I can use to add (time-series) datasets to my package. Here are the specifics: I have created a package subdirectory called data and I am aware that this is the…
Graeme Walsh
  • 638
  • 7
  • 20
14
votes
6 answers

Can't download data from Yahoo Finance using Quantmod in R

I'm trying to download data from Yahoo using this code: library(quantmod) getSymbols("WOW", auto.assign=F) This has worked for me in the past in every occasion except now, 5 days before my group assignment is due. Except now I receive this…
Daniel
  • 149
  • 1
  • 1
  • 4
14
votes
3 answers

Is it possible to write package documentation using non-ASCII characters with roxygen2?

Is it possible to write documentation in R using non-ASCII characters (such as å, ä, ö) using roxygen2? I'm asking because I am writing an package with internal functions in Swedish. I have use the following code using roxygen to write…
FilipW
  • 1,412
  • 1
  • 13
  • 25
14
votes
2 answers

How to define "hidden global variables" inside R packages?

I have the following 2 functions in R: exs.time.start<-function(){ exs.time<<-proc.time()[3] return(invisible(NULL)) } exs.time.stop<-function(restartTimer=TRUE){ if(exists('exs.time')==FALSE){ stop("ERROR: exs.time was not found! Start…
Renan Vilas Novas
  • 1,210
  • 1
  • 10
  • 22
13
votes
0 answers

how do I use @importFrom so that it applies to a whole R package?

automated data analysis workflows I have the following code in my packagename.R file in the packagename folder. I know I am going to use certain functions from other packages routinely, so I want to import them once instead of typing them out all…
wdkrnls
  • 4,548
  • 7
  • 36
  • 64
1
2
3
85 86