r-package

Include errors in R markdown package vignette

拜拜、爱过 提交于 2019-12-08 21:33:15
问题 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 vignette. However, this is causing vignette building to fail. How can I force vignette building to proceed even when the code generates error messages, and retain those error messages in the vignette document? 回答1: The knitr chunk options documentation

Building a vignette

ⅰ亾dé卋堺 提交于 2019-12-08 06:17:20
问题 I was developing a package when I found a new error when building the package.The error makes reference to a line that previously didn't have any problem and I didn't modify. However it run smoothly in a fresh R session when I ran the code or knit the vignette alone. Long story short: I found that this error happens when a suggested package (by my package's DESCRIPTION) is loaded before my package. How can I control this? The reason of the error is that my package (A) has a function is named

how to install r package for oracle on windows 10 64 bit

我的梦境 提交于 2019-12-08 04:56:51
问题 while installing rpackage Roracle on windows 10 i'm getting stuck at this point install.packages("ROracle") Installing package into ‘C:/Users/admin/Documents/R/win-library/3.3’ (as ‘lib’ is unspecified) Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘ROracle’ Do you want to attempt to install these from sources? y/n: y installing the source package ‘ROracle’ trying URL 'https://cran.rstudio.com/src/contrib/ROracle_1.3-1.tar.gz' Content type

Calling Rcpp function with Xptr and Function - only xptr case works

穿精又带淫゛_ 提交于 2019-12-07 17:58:15
问题 I am trying to develop a package in which I need to input a function from user (could be defined using Rcpp or in R ), send it to another function (within the package) in a struct and process it there. When I use Rcpp::Xptr (i.e., function pointer) the code works, but the same does not work with Rcpp::Function . The advantage with using Rcpp::Function for the user would be that they would be able to define the function in R (although lose a lot of performance gain). First what works: #include

R package: underscores added to RcppExports.R when building

大兔子大兔子 提交于 2019-12-06 11:52:30
I work from different computers on the same R package with Rstudio, but for some reason, whenever I build the package, some of the computers will modify the RcppExports.R and RcppExports.cpp files by adding underscore in front of some functions. For example, this can be found when looking at the dif between the files before and after compiling the package (first line is before, second is after): .Call('PkgName_FunctionName', PACKAGE = 'PkgName', arguments) .Call('_PkgName_FunctionName', PACKAGE = 'PkgName', arguments) This bothers me because git sees this as a change. My questions are: Why is

R package with both .c and .cpp files with Rcpp

女生的网名这么多〃 提交于 2019-12-06 10:16:22
I'm trying to build an R package which contains both C (in the form of .c files) and C++ code (in the form of .cpp files) using the Rcpp package as a dependency. I have a couple of questions. First, is it actually possible to do this? Can one call C scripts and C++ scripts that are in the same R package? If the previous is possible, how then does one properly register the functions in the C and C++ scripts. To help with this, I have set up a little example which is available on my GitHub page ( https://github.com/tpbilton/testrcpp ). I have used Rcpp.package.skeleton("testrcpp") to initialize

Understanding `Makevars` for linking to external C library in R package

陌路散爱 提交于 2019-12-06 07:42:14
问题 I am working on a package which includes C code from third-party library (SUNDIALS). The package compiles and works (i.e., is able to solve a test ODE) with the following Makevars file performing static linking CXX=clang++ PKG_CPPFLAGS = -I../inst/include PKG_LDFLAGS = /usr/local/lib PKG_LIBS= $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(PKG_LDFLAGS)/libsundials_cvode.a $(PKG_LDFLAGS)/libsundials_nvecserial.a However, a slightly modified version (based on the example in R-Exts, i.e. - PKG_LIBS = -L

Imported packages do not auto-install

て烟熏妆下的殇ゞ 提交于 2019-12-06 06:11:18
问题 I have a private package stored locally (and version-controlled via SVN). To install the package, I am asking the user to SVN-update his/her package directory, then setwd() on the directory, and then devtools::install() . This package imports many CRAN packages, which are not stored locally. These imported packages are not auto-installing during the installation, which produces the error message Dependency package foo not available . The user must manually install install.packages('foo') ,

How to point to a directory in an R package?

心已入冬 提交于 2019-12-06 04:02:59
问题 I am making my first attempts to write a R package. I am loading one csv file from hard drive and I am hoping to bundle up my R codes and my csv files into one package later. My question is how can I load my csv file when my pakage is generated, I mean right now my file address is something like c:\R\mydirectory....\myfile.csv but after I sent it to someone else how can I have a relative address to that file? Feel free to correct this question if it is not clear to others! 回答1: You can put

How to add external data file into developing R package?

喜欢而已 提交于 2019-12-05 14:20:29
I am building my R packages in Rstudio, I ran into some unexpected problem when I tired to create package' vignette. when I hit build/load panel in Rstudio, I got vignette error, while package's documentation was created. To possibly solve vignette error I got, I have to add external data to my packages, use this data to compile package vignette accordingly. I used devtools::install() command to install my packages, but inst/ directory is not created. extdata must be located in inst directory. I also used devtools::use_data() to add my data from my PC, but I can't able to add my external data.