r-package

Installing coreNLP in R

最后都变了- 提交于 2019-11-29 16:10:31
I'm following the instructions on this link to use coreNLP https://github.com/statsmaths/coreNLP However, I found this error > library(coreNLP) Error in get(method, envir = home) : lazy-load database '/Users/apple/Library/R/3.2/library/coreNLP/R/coreNLP.rdb is corrupt In addition: Warning messages: 1: In .registerS3method(fin[i, 1], fin[i, 2], fin[i, 3], fin[i, 4], : restarting interrupted promise evaluation 2: In get(method, envir = home) : restarting interrupted promise evaluation 3: In get(method, envir = home) : internal error -3 in R_decompress1 Error: package or namespace load failed for

Adding an external library in R package using Rcpp

情到浓时终转凉″ 提交于 2019-11-29 15:25:44
问题 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 from the library in /inst/include/sundials-2.6.2 and the .c files in src/sundials-2.6.2 of my package folder. From my reading of the SO posts on this topic, sourceCpp of code in multiple files (e.g., separate .h and .cpp files should work if they

Requiring OpenMP availability for use in an Rcpp package

泪湿孤枕 提交于 2019-11-29 09:58:31
问题 I have prepared a package in R by using RcppArmadillo and OpenMP libraries and following commands: RcppArmadillo.package.skeleton("mypackage") compileAttributes(verbose=TRUE) Also, in the DESCRIPTION file I added: Imports: Rcpp (>= 0.12.8), RcppArmadillo LinkingTo:Rcpp, RcppArmadillo Depends: RcppArmadillo and in the NAMESPACE file I added: import(RcppArmadillo) importFrom(Rcpp, evalCpp) Then I run the following codes in cmd : R CMD build mypackage R CMD INSTALL mypackage.tar.gz I build and

How to put datasets into an R package

元气小坏坏 提交于 2019-11-29 07:08:09
问题 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 location where I should save the datasets that I want to add to my package. I am also cognizant of the fact that the files containing the data may be . rda , .txt , or .csv files. Each series of data that I want to add to the package consists of a

How to modify unexported object in a package

旧时模样 提交于 2019-11-28 13:42:16
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 in this post to R-help: The few times I want to patch a function like this, I use: unlockBinding(name, env); assignInNamespace(name, value, ns=pkgName, envir=env); assign(name, value, envir=env); lockBinding(name, env); But because f is unexported, this doesn't work. Simple example to illustrate the problem: # rf is an exported function from the

HTTP error 400 on google_elevation() call

帅比萌擦擦* 提交于 2019-11-28 12:58:33
I am using the R-package googleway to decode polylines using decode_pl and subsequently getting the elevation data at the corresponding lat/lon coordinates using google_elevation . I get the polylines from Strava , using the rStrava package. Sample polylines: pl1 <- "q{|aHknlv@n@Mt@IxAGb@B\\Eb@AZGRG^W`AyAPQF?NHDJFZBz@FVNPn@D`@C|@DjACv@@h@Dh@Ll@Zj@^\\`@fAx@j@r@d@n@\\ZJPNd@NbANzAFhANb@JNLHD?PKHMRGPSr@UPMXGDGJELMFCPAbBWROpAm@h@YZe@dAaC@Of@aAb@a@t@iALg@LWNQROf@IjAJnFbAv@Dr@Aj@BpBx@fFdCd@HlAHd@Pp@b@|@d@~@j@n@R~@n@\\NTCXBNEZCZKbB]rAKpDK~BO\\?NCd@?`DMz@SLO`@URCR@XLRRRVHd@NXNP\\RXf@JHXN\\Xn@ZD@Z?\

Installing coreNLP in R

最后都变了- 提交于 2019-11-28 09:22:45
问题 I'm following the instructions on this link to use coreNLP https://github.com/statsmaths/coreNLP However, I found this error > library(coreNLP) Error in get(method, envir = home) : lazy-load database '/Users/apple/Library/R/3.2/library/coreNLP/R/coreNLP.rdb is corrupt In addition: Warning messages: 1: In .registerS3method(fin[i, 1], fin[i, 2], fin[i, 3], fin[i, 4], : restarting interrupted promise evaluation 2: In get(method, envir = home) : restarting interrupted promise evaluation 3: In get

R: How to run some code on load of package?

 ̄綄美尐妖づ 提交于 2019-11-28 06:45:31
I am learning to build a package for R. Now to set it up I need to run some code when the package is being loaded via require(myPackage) . I read the documentation on help(".onLoad") that just made me really confused as there is no example. How do I actually use .onLoad ? Can someone please show me a simple example? For example I know export(myfun) in the NAMESPACE file will export myfun for use, what is the code that I need to run say rnorm(10) at package load? There is usually a "processing function" (traditionally called zzz.R ) with tasks to be performed when the package is loaded, such as

Problems with installation R packages

↘锁芯ラ 提交于 2019-11-27 20:19:59
Im windows user. A few weeks ago I installed R and Rstudio and installed many packages. Today there was a spell that new packages are not installed. Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib : cannot open URL ' http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES ' I reinstalled R but this did not solve the problem. Warning in install.packages : InternetOpenUrl failed: 'Can not connect to server' This is something that pops up in R and RStudio only once in a while. RStudio changes quite a few settings, and the option "repos" is one of them

Show names of everything in a package

寵の児 提交于 2019-11-27 13:41:40
Is there an easy way to list everything in a package from within R? For example, if I type foreach::: and hit tab twice, I can see everything that's there. How else can I get those names of objects? Note, ls("package:foreach", all.names=TRUE) does not show things like .foreachGlobals ls("package:foreach", all.names=TRUE) only shows what's attached to the search path, which only includes the objects exported from the namespace. Use ls on the results of getNamespace instead: ls(getNamespace("foreach"), all.names=TRUE) A utility that I've been using which I find useful for this (and also gives