r-package

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

余生长醉 提交于 2021-02-19 01:37:52
问题 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 installed it, i.e, install.package("my_package") . Nevertheless, once I have installed the package I am able to use all the functions of the installed but not loaded package through my_package::my_function() , so if my package has dependencies, beside

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

↘锁芯ラ 提交于 2021-02-19 01:37:48
问题 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 installed it, i.e, install.package("my_package") . Nevertheless, once I have installed the package I am able to use all the functions of the installed but not loaded package through my_package::my_function() , so if my package has dependencies, beside

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

那年仲夏 提交于 2021-02-19 01:37:06
问题 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 installed it, i.e, install.package("my_package") . Nevertheless, once I have installed the package I am able to use all the functions of the installed but not loaded package through my_package::my_function() , so if my package has dependencies, beside

Error in dyn.load(dllfile) — problem with building a package linking to Rcpp

江枫思渺然 提交于 2021-02-11 15:40:09
问题 My package will not install, either on my machine or on travis-ci.org. The only update from the version on CRAN is that I added a vignette. I have been following the examples of Rcpp - package and R-packages; compiled code. The error is related to these prior questions but not a duplicate. Q40922814 -- problem here was the use of both C and C++ code. I only use C++ code Q36952571 -- I'm on Mac OS, so no access to ldconfig , though perhaps my problem is related. Error: from the package

Error in dyn.load(dllfile) — problem with building a package linking to Rcpp

拥有回忆 提交于 2021-02-11 15:38:35
问题 My package will not install, either on my machine or on travis-ci.org. The only update from the version on CRAN is that I added a vignette. I have been following the examples of Rcpp - package and R-packages; compiled code. The error is related to these prior questions but not a duplicate. Q40922814 -- problem here was the use of both C and C++ code. I only use C++ code Q36952571 -- I'm on Mac OS, so no access to ldconfig , though perhaps my problem is related. Error: from the package

How to add CSS external files to be used by my R package function?

夙愿已清 提交于 2021-02-10 19:40:21
问题 I'm making a personal package and would like to load a css file in one of the functions in this package in order to have a "default style". What is the optimal way of doing this? I cannot find any documnetation that helps me understand how to work with external data like a css file, mostly what I find is about exporting external datasets to be loaded separately, etc. 回答1: I found the problem. I was using the inst/extdata folder to export my style.css file, but was trying to read it directly

Is there a way to automatically generate `Imports` section in the DESCRIPTION file?

↘锁芯ラ 提交于 2021-02-07 08:31:56
问题 When developing an R package, it is common for me to just turn on Packrat and use a localized repository, and develop as I explore in a session. But when publishing the package, it is a big headache to recall and manually add every dependency I have used in the developed package. Is there a (semi-)automatic way to do this? For example, in NodeJS development, we can just use npm install --save and the dependency will be added automatically to package.json . 回答1: Yes, use roxygen2 to generate

Importing an Rcpp header file in NAMESPACE within an R Package

China☆狼群 提交于 2021-01-29 17:26:54
问题 This is my first package in R , I already have working package but I would remove some rewriting function in cpp file, so I do an header file that work with single function. How can I put this header in package? Note that header.h and header.cpp are in src/ directory of package and the #include "header.h" is in the .cpp file where I use this function I tried to modify the NAMESPACE file with: import(myheader) But, when I do: R CMD INSTALL mypackage I receive this error: Error: package or

Cannot install httr package in R 3.6.2 in Linux Mint 19.3

岁酱吖の 提交于 2021-01-28 21:17:47
问题 I am totally new to R. I tried to install the httr package. I first installed pacman, and then tried to load httr through it by running pacman::p_load(httr) . It wasn't successful. And it showed the following message in terminal- Installing package into ‘/home/|username|/R/x86_64-pc-linux-gnu-library/3.6’ (as ‘lib’ is unspecified) also installing the dependencies ‘curl’, ‘openssl’ trying URL 'https://cloud.r-project.org/src/contrib/curl_4.3.tar.gz' Content type 'application/x-gzip' length

Export S3 method for a 'function' class object

时光总嘲笑我的痴心妄想 提交于 2021-01-27 15:15:56
问题 Function objects seems to work well with dispatching of S3 methods. But for some reason they cannot be exported in NAMESPACE file. Below code works with dispatching to *.function method: as.abc = function(x, ...){ UseMethod("as.abc") } as.abc.list = function(x, ...){ stopifnot(is.list(x)) structure(x, class="abc") } as.abc.function = function(x, ...){ stopifnot(is.function(x)) structure(x, class="abc") } # list l = as.abc(list(1)) str(l) #List of 1 # $ : num 1 # - attr(*, "class")= chr "abc"