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

Unicode character in R-package Authors Name

Lots of European authors have Unicode characters in their names such as Å, Æ, ø and Ä. How can they have their actual name with these Unicode characters rather than some transformed version of the English alphabet (Å -> A, Æ -> A, Ä -> A) when…
TheRimalaya
  • 4,232
  • 2
  • 31
  • 37
6
votes
2 answers

How to cleanly define a set of variables when an R package loads and clear them on unload?

I would like to have a set of colors become defined when a package loads and cleared when package detaches. What I've come up with that seems to work is shown in the following toy example which relies on deep assignment (which I know to be…
Avraham
  • 1,655
  • 19
  • 32
6
votes
1 answer

Refreshing sysdata.rda after reinstalling R package

I'm developing a package in R (3.3.2) that has internal data. The data is added to ./R/sysdata.rda via devtools::use_data(dataset, pkg = 'pkgName', internal = TRUE, overwrite = TRUE) Within the package I've added and exported a simple…
gph
  • 1,045
  • 8
  • 25
6
votes
0 answers

Error in dyn.load(dllfile) : unable to load shared object | Expected in: flat namespace

I am new to R package development. I am developing a package (bartpkg) that has in its src/ folder one (prime) cpp file and some helper cpp (X.Cpp, Y.Cpp) and one c file (Z.C) and their header files (X.h, Y.h and Z.h) I am getting the following…
Usernow
  • 149
  • 2
  • 8
6
votes
3 answers

how to use utils::globalVariables

Following your recommendations (or trying to do it, at least), I have tried some options, but the problem remains, so there must be something I am missing. I have included a more complete code setwd("C:/naapp") #' @import utils #' @import devtools…
Marina
  • 369
  • 3
  • 9
6
votes
2 answers

How to override exported function from R package listed in Imports

My package's DESCRIPTION file has httr in its Imports directive: Imports: httr (>= 1.1.0), jsonlite, rstudioapi httr exports an S3method for length.path. S3method(length,path) And it's defined as: #' @export length.path <- function(x)…
Nicole White
  • 7,720
  • 29
  • 31
6
votes
1 answer

How to modify unexported object in a package

My package (let's call it A) depends on another package B. I need to modify a function f in B that has a bug that is causing my package to fail. The problem is that f is an unexported function. If f was exported, I could use the technique described…
Hong Ooi
  • 56,353
  • 13
  • 134
  • 187
6
votes
1 answer

Adding an external library in R package using Rcpp

I am trying to develop an R package which uses the Sundials C library for solving differential equations. In order to not have the user install the library, I am putting the source code of the library in my package. I have put all the header files…
Satya
  • 1,708
  • 1
  • 15
  • 39
6
votes
1 answer

How to make R package recommend a package hosted on GitHub?

I'm developing an R package that works as a wrapper for functions from the parallel and Rhpc packages called ctools. I know that if I want my package to require these packages I need to include them in the Imports section of the DESCRIPTION file.…
6
votes
1 answer

Use dependencies in R packages through library() / Description file

I'm writing an R package that has several dependencies of other packages, some of them are available in CRAN and other ones are homemade. According to the help, library("my_package") will load the namespace of the package once I have previously…
blamblam
  • 423
  • 6
  • 20
6
votes
1 answer

R programming MCA() in FactoMineR error message

I was using the MCA() function from FactoMineR package in R to do the multiple correspondence analysis on a set of around 160 variables with around 2000 observations. Around 150 of the variables are continuous, so I first used the cut() function to…
Jingjing Ni
  • 61
  • 1
  • 4
6
votes
4 answers

Trouble building R package wtih devtools when it uses RcppArmadillo

This is my first stackoverflow question, so please be kind, folks! I have greatly enjoyed my recently-found power to build R packages using devtools. However, as soon as I try building a package that uses RcppArmadillo, my workflow of running…
6
votes
1 answer

Import one function in R package (without importFrom)

I'm writing an R package and I'd like to use one function from another package (plotKML). This external package has so many dependencies that I don't want my users to be required to download etc. If I use importFrom(plotKML, readGPX) in the…
ZRoss
  • 1,437
  • 1
  • 15
  • 32
6
votes
2 answers

Error while installing Apache SparkR package

I am getting the following error while installing the apache sparkr package: install_github("amplab-extras/SparkR-pkg", subdir="pkg") Downloading github repo amplab-extras/SparkR-pkg@master Installing SparkR Error in isNamespaceLoaded(pkg) : …
Ganesh Bhat
  • 295
  • 7
  • 20
6
votes
1 answer

Install R package from github without devtools (due to firewall)

I am not able to use devtools to install R packages from github since I have a firewall that prevents R from connecting to the internet. I thought of making a .tar.gz file from the git repository but the problem is that the repository does not…
Michal
  • 1,863
  • 7
  • 30
  • 50