After a bit of googling and stalking stackoverflow, I think I may have stumbled onto a bug with the reshape2 package (or data.table, I'm not sure). Specifically, I am unable to melt a particular data.table of mine.
Here's a reproducible example (you can find a copy of that particular .Rdata file here):
library(data.table)
library(ggplot2)
library(reshape2)
load("mpi_cv_vanilla_random_gov_17h55--100_class_widths.Rdata")
melt(par.grid.results)
Before I run melt, my usessionInfo is as follows:
> sessionInfo()
R version 3.0.2 (2013-09-25)
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=en_US.UTF-8 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] reshape2_1.2.2 ggplot2_0.9.3.1 data.table_1.8.10
loaded via a namespace (and not attached):
[1] colorspace_1.2-4 dichromat_2.0-0 digest_0.6.4 grid_3.0.2
[5] gtable_0.1.2 labeling_0.2 MASS_7.3-29 munsell_0.4.2
[9] plyr_1.8 proto_0.3-10 RColorBrewer_1.0-5 scales_0.2.3
[13] stringr_0.6.2 tools_3.0.2
And once I run melt(par.grid.results), RStudio throws up the picture of the bomb with dialogue:
"R Session Aborted \nR encountered a fatal error \nThe session was terminated".
If anyone has any ideas as to what's going on, I'd love to hear them.
Thanks!
Edit: Running this inside the terminal, I get the following error (segfault):
> melt(par.grid.results)
Using as id variables
*** caught segfault ***
address 0x18, cause 'memory not mapped'
Traceback:
1: unlist(unname(data[var$measure]))
2: melt.data.frame(par.grid.results)
3: melt(par.grid.results)
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Related
I am new to linux and struggling with installing caret for R. I am receiving the following error during the caret install process.
configure: Need to download and build NLopt
trying URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
Error in download.file(url = "http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz", :
cannot open URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
Execution halted
/bin/gtar: This does not look like a tar archive
gzip: stdin: unexpected end of file
/bin/gtar: Child returned status 1
/bin/gtar: Error is not recoverable: exiting now
Warning message:
In untar(tarfile = "nlopt-2.4.2.tar.gz") :
'/bin/gtar -xf 'nlopt-2.4.2.tar.gz'' returned error code 2
configure: Starting to install library to /tmp/RtmpIT5jNR/R.INSTALL17d113d7c2a/nloptr/nlopt-2.4.2
./configure: line 3325: cd: nlopt-2.4.2: No such file or directory
It stops after this, floating and then I have to crash R to fix it. I have scoured through the nlopt site and based on the error have attempted to install into R manually. I have the actual tar file and I have placed it into Rstudios package file, then gone through the process of installing it. However, this does not seem to work at all. I am guessing there is something specific to R that needs to be done to complete the install?
Note I have tried installing just the nlopt via install.packages and the same error occurs. Any ideas?
Edit 1:
> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS release 6.9 (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] grid stats graphics grDevices utils datasets
[7] methods base
other attached packages:
[1] nnet_7.3-11 Hmisc_3.17-0 Formula_1.2-1
[4] survival_2.38-3 lattice_0.20-33 readxl_0.1.0
[7] reshape2_1.4.1 ggplot2_1.0.1 dplyr_0.4.3
[10] data.table_1.9.6
loaded via a namespace (and not attached):
[1] Rcpp_0.12.2 cluster_2.0.3 magrittr_1.5
[4] splines_3.2.2 MASS_7.3-43 munsell_0.4.2
[7] colorspace_1.2-6 R6_2.1.1 stringr_1.0.0
[10] plyr_1.8.3 tools_3.2.2 parallel_3.2.2
[13] gtable_0.1.2 latticeExtra_0.6-26 DBI_0.3.1
[16] lazyeval_0.1.10 assertthat_0.1 digest_0.6.8
[19] gridExtra_2.0.0 RColorBrewer_1.1-2 acepack_1.3-3.3
[22] rpart_4.1-10 stringi_1.0-1 RevoUtils_8.0.0
[25] scales_0.3.0 foreign_0.8-65 chron_2.3-47
[28] proto_0.3-10
I reconogize I am not using the most recent version of R and unfortunitly will not be able to upgrade. However, Caret package information claims it should work on anything greater than R(>=2.1), lattice(>=0.2) and ggplot2. All of which criteria is met.
I have a downloadHandler() in Shiny that generates an html document using R markdown. This document generates rgl plots, which are added to the document using hook_webgl. The application is running on a Shiny server. Everything works fine the first time the download button is used, but on the following occasions I get the error "You must enable Javascript to view this page properly". I am using rglwidgets, but I get the same issues using shinyRGL.
> sessionInfo()
R version 3.2.4 Revised (2016-03-16 r70336)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.4 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 methods base
other attached packages:
[1] shiny_0.13.2 rmarkdown_0.9.5 knitr_1.12.3 rglwidget_0.1.1434
[5] rgl_0.95.1441
loaded via a namespace (and not attached):
[1] htmlwidgets_0.6 magrittr_1.5 R6_2.1.2 tools_3.2.4
[5] htmltools_0.3.5 Rcpp_0.12.4 jsonlite_0.9.19 digest_0.6.9
[9] xtable_1.8-2 httpuv_1.3.3 mime_0.4
I am using default command to install multicore package
install.packages('multicore','http://www.rforge.net/')
as written here http://www.rforge.net/multicore/files/ but I recieve warning:
install.packages('multicore','http://www.rforge.net/')
Warning in install.packages :
'lib = "http://www.rforge.net/"' is not writable
Would you like to use a personal library instead? (y/n) y
Warning in install.packages :
package ‘multicore’ is not available (for R version 3.1.2)
Does anybody know any solution to this? I can not use previous versions of R.
I would like to use mclapply function from that package.
Thanks for help.
My session info is:
> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-redhat-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=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] stringi_0.4-1 ggplot2_1.0.0
loaded via a namespace (and not attached):
[1] colorspace_1.2-4 digest_0.6.8 grid_3.1.2 gtable_0.1.2
[5] MASS_7.3-35 munsell_0.4.2 plyr_1.8.1 proto_0.3-10
[9] Rcpp_0.11.3 reshape2_1.4.1 scales_0.2.4 stringr_0.6.2
[13] tools_3.1.2
Why do you need it?
Most of its functionality has been integrated into the parallel package which already comes with R. Have a look at its vignette, eg from within R via vignette() or else from here.
And the reason you cannot install 'multicore' is because it has been withdrawn by R Core, given how its functionality is (essentially entirely) in 'parallel' now.
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'm switching from Sweave to knitr and like it very much. Big THANKS to Yihui!
One thing that keeps annoying me is that plot windows pop up and get active. So when I write while knitr is working, my editor looses focus every so often. This happens even if there's no plot produced in the code chunk.
Is there a way to avoid this?
Here's my sessionInfo (), in case that helps:
R version 2.15.0 (2012-03-30)
Platform: x86_64-unknown-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=de_DE.UTF-8 LC_NUMERIC=C
[3] LC_TIME=de_DE.UTF-8 LC_COLLATE=de_DE.UTF-8
[5] LC_MONETARY=de_DE.UTF-8 LC_MESSAGES=de_DE.UTF-8
[7] LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] hyperSpec.sim_0.5 mvtnorm_0.9-9992 hyperSpec_0.98-20120531
[4] lattice_0.20-6 knitr_0.5
loaded via a namespace (and not attached):
[1] arrayhelpers_0.75-20120531 codetools_0.2-8
[3] digest_0.5.2 evaluate_0.4.2
[5] formatR_0.4 highlight_0.3.1
[7] parser_0.0-14 plyr_1.7.1
[9] Rcpp_0.9.10 stringr_0.6
[11] tools_2.15.0
This must have been fixed in a commit last week. There will not be plot windows opened any more. If you do not know how to install the development version, you will wait for about one week for the next CRAN release, otherwise just install from Github.