Edit: Solved, the error dissapeared whe I updated the package.
I'm getting an error when working with just one summary statistic. Is there any reason why this is happening? Is there a way to get around this problem?
Thanks
library(abc)
data(human)
target<-(stat.voight["hausa",])[,1]
sumstat<-(stat.3pops.sim)[,1]
modsel.ha <- postpr(target, models, sumstat, tol=.05, method="mnlogistic")
#Error in eval(predvars, data, env) : numeric 'envir' arg not of length one
Aditional details: no other objects were loaded (to my knowledge) as the R session had just been started. When I use two summary statistics instead of just 1 postpr works fine.
Session details as per request from nograpes
sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: i686-pc-linux-gnu (32-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=de_DE.UTF-8
[7] LC_PAPER=C LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] abc_1.5 locfit_1.5-7 quantreg_4.79 SparseM_0.96 nnet_7.3-4 MASS_7.3- 21
loaded via a namespace (and not attached):
[1] grid_2.15.1 lattice_0.20-10 tools_2.15.1
The problem turned out to be solved when I upgraded abc. Surely it was a bug of an old version of the package.
Related
Well I spot this when I actually made a mistake. I want to get the manual page of mgcv.FAQ, but I
forgot to do library(mgcv);
wrongly put ?mgcv-faq.
But, R strangely directs me to the doc page as if I have done ?Arithmetic.
What is going on? After I do library(mgcv), putting ?mgcv-faq now gives an error:
#Error in eval(argExpr, envir) : object 'mgcv' not found
#Error in .signatureFromCall(fdef, expr, envir, doEval) :
# error in trying to evaluate the expression for argument ‘e1’ (mgcv)
Can anyone explain this behavior?
sessionInfo() before library(mgcv):
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.5 LTS
Matrix products: default
BLAS/LAPACK: /usr/lib/libopenblas.so
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
[5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=en_GB.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.4
attached base packages:
[1] stats graphics grDevices utils datasets methods base
sessionInfo() after library(mgcv):
## only shows what is different from the above
other attached packages:
[1] mgcv_1.8-24 nlme_3.1-137
loaded via a namespace (and not attached):
[1] compiler_3.4.4 Matrix_1.2-14 tools_3.4.4 grid_3.4.4
[5] lattice_0.20-35
I don't have Rstudio, so I run R in the terminal. And the manual page is displayed in the terminal.
You can reproduce this with:
expr <- quote(mgcv-faq)
utils:::.helpForCall(expr, parent.frame())
.helpForCall gets called by ? internally with this input.
Now, if the expression does not contain :: or ::: calls, .helpForCall extracts the symbol to look up by doing
expr[[1L]]
#`-`
without checking the length of the expression.
The - operator is first in the expression because the expression is parsed to function syntax.
Why does this happen? Because ? should be able to handle :: and ::: in its input and nobody thought of handling a user error such as yours.
I am getting the following error every time I run a Cox model using the survival package in R. This error arose within the last few days. To illustrate the error, I am using a standard example command which is given at https://stat.ethz.ch/R-manual/R-devel/library/survival/html/coxph.html:
# Fit a stratified model, clustered on patients
library(survival)
bladder1 <- bladder[bladder$enum < 5, ]
coxph(Surv(stop, event) ~ (rx + size + number) * strata(enum) +
cluster(id), bladder1)
The error I get is as follows:
Error in fitter(X, Y, strats, offset, init, control, weights = weights, :
object 'Ccoxmart' not found
I am using latest version of R [3.4.0 (2017-04-21) -- "You Stupid Darkness"].
I have tried to consult the survival package manual for R and researched on the internet. I am grateful for any resource or solution you may recommend.
I can confirm this error. It's definitely something to do with the update from R 3.3.3 (Another Canoe) -> R 3.4.0 (You Stupid Darkness). All unit tests in my system working correctly on Friday, broken Monday.
In addition, I'm also having an issue with "Ccoxph_wtest" not being found. Must be a similar issue.
I'll start debugging later today and let you know what I find, but for now if you have to get back up and running, I'd suggest reverting to R v3.3.3 (Another Canoe). I have rerun all my unit tests using v3.3.3 and all is fine.
Here is the sessionInfo():
R version 3.3.3 (2017-03-06)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.2 LTS
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets base
R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.2 LTS
Matrix products: default
BLAS: /usr/lib/atlas-base/atlas/libblas.so.3.0
LAPACK: /usr/lib/atlas-base/atlas/liblapack.so.3.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets base
loaded via a namespace (and not attached):
[1] compiler_3.4.0
My solution was to re-install the survival package. Just install it right on top of the original. install.packages("survival").
You have to re-install packages that use C or Fortran in R 3.4.0:
update.packages(checkBuild=TRUE)
See this post
Packages which register native routines for .C or .Fortran need
to be re-installed for this version (unless installed with
R-devel SVN revision r72375 or later)
I recently installed rSymPy to perform some symbolic calculations in R. This step also installed some dependencies (“rJava”, “rjson” and “rJython”). After the installation was complete, I loaded the library and ran a very simple command which gave me an error:
> library("rSymPy")
Loading required package: rJython
Loading required package: rJava
Loading required package: rjson
> x <- Var("x")
Error in .jcheck() : No running JVM detected. Maybe .jinit() would help.
Here is my sessionInfo(), just in case you need it:
> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS release 6.7 (Final)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rSymPy_0.2-1.1 rJython_0.0-4 rjson_0.2.15 rJava_0.9-8
loaded via a namespace (and not attached):
[1] tools_3.2.2 tcltk_3.2.2
I have tried to install different versions of required packages, but I always get this error. I would really appreciate any help.
Thanks,
Aashish
Thanks to Gabor Grothendieck (developer of rSymPy) for pointing out that sometimes one needs to manually initialize JVM. One can simply use "sympyStart()" at the beginning of the code, and that fixes the error.
Exporting an Rcpp function with a different name succeeds on one machine but fails on the other. The R environments are very similar. What am I doing wrong?
Details
I have an R package with an Rcpp function that is exported with the following signature (in sample_int_crank.cpp):
// [[Rcpp::export(sample.int.crank)]]
IntegerVector sample_int_crank(int n, int size, NumericVector prob) {
...
This function is declared empty in a corresponding R file (sample_int_crank.R):
sample.int.crank <- function(n, size, prob) {
}
EDIT: When I remove this R file, the function is available. But where do I place roxygen2 comments for this function?
Now, when I install the package from GitHub,
library(devtools)
install_github('wrswoR', 'muelleki', '0.0.6')
on machine A it says:
> sample.int.crank
internal C++ function <0x29ddc40>
signature : Rcpp::IntegerVector sample.int.crank(int, int, Rcpp::NumericVector)
and on machine B:
> sample.int.crank
function(n, size, prob) {
}
<environment: namespace:wrswoR>
EDIT: If sample_int_crank.R is removed from the package, the output looks different, but identical on A and B. What is going on here?
library(devtools)
install_github('wrswoR', 'muelleki')
> sample.int.crank
function (n, size, prob)
{
.Call("wrswoR_sample_int_crank", PACKAGE = "wrswoR", n, size,
prob)
}
<environment: namespace:wrswoR>
The sessionInfo() seems to be more or less identical, at least for R and Rcpp -- A:
> sessionInfo()
R version 2.15.3 (2013-03-01)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] wrswoR_0.0.6 logging_0.7-102 Rcpp_0.10.3 devtools_0.8
loaded via a namespace (and not attached):
[1] digest_0.5.2 evaluate_0.4.2 httr_0.1.1 memoise_0.1
[5] parallel_2.15.3 plyr_1.7.1.99.2 RCurl_1.95-0 stringr_0.6.1
[9] tools_2.15.3 whisker_0.1
B:
> sessionInfo()
R version 2.15.3 (2013-03-01)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.utf-8 LC_NUMERIC=C
[3] LC_TIME=en_US.utf-8 LC_COLLATE=en_US.utf-8
[5] LC_MONETARY=en_US.utf-8 LC_MESSAGES=en_US.utf-8
[7] LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.utf-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] wrswoR_0.0.6 logging_0.6-92 Rcpp_0.10.3 devtools_1.1
loaded via a namespace (and not attached):
[1] digest_0.6.3 evaluate_0.4.3 httr_0.2 memoise_0.1
[5] parallel_2.15.3 RCurl_1.95-4.1 stringr_0.6.2 tools_2.15.3
[9] whisker_0.1
Any idea?
Concerning your question
But where do I place roxygen2 comments for this function?
I have to disappoint you that here simply is no support for roxygen(2) in Rcpp Attributes. Maybe you want to contribute that?
On the other hand, writing normal C++ functions in src/ and calling them from normal R functions is of course supported, and can be used by roxygen2 just fine.
As to what devtools does to your package: Also no idea. Neither Romain nor myself uses devtools, so you are in undocumented and undefined territory.
I am updating a package qdap that had a single note on CRAN in its previous build, which was resolved.
In the qdap development version, under R 2.15.3, using --as-cran and --resave-data=best, I get the following note:
* checking R code for possible problems ... NOTE
Segmentation fault
Why is this segfault occurring (I'm somewhat new to Linux)? How can I find it? I googled this for sometime but I couldn't figure out what the problem is. I gather there's some sort of problem in my code but...
On Windows I get no notes.
I can provide more info if needed (though the GitHub repo is available).
Session Info:
R version 2.15.3 (2013-03-01)
Platform: i686-pc-linux-gnu (32-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=C LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] pacman_0.2.0 XML_3.9-4
loaded via a namespace (and not attached):
[1] tools_2.15.3