test.data.table errors R - r

Ran a test for data.table on my new installation of R and got the below errors:
> test.data.table()
Error in eval(exprs[i], envir) :
10 errors out of 8403 (lastID=1887, endian==little, sizeof(long
double)==16, sizeof(pointer)==8) in inst/tests/tests.Rraw on Tue Apr 03
11:28:16 2018. Search tests.Rraw for test numbers: 546, 1693.4, 1693.5,
1693.6, 1693.7, 1693.9, 1702.1, 1702.2, 1702.3, 1702.4.
All errors were of the kind:
Test testnum ran without errors but failed check that x equals y:
Where testnum is the test that failed (from above message).
Some more details:
R version 3.4.4 (2018-03-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=English_Canada.1252 LC_CTYPE=English_Canada.1252 LC_MONETARY=English_Canada.1252
[4] LC_NUMERIC=C LC_TIME=English_Canada.1252
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] rmarkdown_1.9 curl_3.1 caret_6.0-78 lattice_0.20-35 xts_0.10-1 zoo_1.8-1
[7] nlme_3.1-131.1 hexbin_1.27.2 testthat_2.0.0 plyr_1.8.4 knitr_1.20 bit64_0.9-7
[13] bit_1.1-12 ggplot2_2.2.1 lubridate_1.7.2 data.table_1.10.5 gmad_0.0.0.9000 reshape2_1.4.3
[19] reshape_0.8.7
loaded via a namespace (and not attached):
[1] httr_1.3.1 ddalpha_1.3.1.1 tidyr_0.8.0 sfsmisc_1.1-2 splines_3.4.4
[6] foreach_1.4.4 prodlim_1.6.1 assertthat_0.2.0 highr_0.6 stats4_3.4.4
[11] DRR_0.0.3 yaml_2.1.17 robustbase_0.92-8 ipred_0.9-6 pillar_1.2.1
[16] backports_1.1.2 glue_1.2.0 digest_0.6.15 colorspace_1.3-2 recipes_0.1.2
[21] htmltools_0.3.6 Matrix_1.2-12 psych_1.7.8 timeDate_3043.102 pkgconfig_2.0.1
[26] CVST_0.2-1 broom_0.4.3 purrr_0.2.4 scales_0.5.0 gower_0.1.2
[31] lava_1.6 tibble_1.4.2 withr_2.1.1 nnet_7.3-12 lazyeval_0.2.1
[36] mnormt_1.5-5 survival_2.41-3 magrittr_1.5 evaluate_0.10.1 MASS_7.3-49
[41] dimRed_0.1.0 foreign_0.8-69 class_7.3-14 tools_3.4.4 stringr_1.3.0
[46] kernlab_0.9-25 munsell_0.4.3 bindrcpp_0.2 compiler_3.4.4 RcppRoll_0.2.2
[51] rlang_0.2.0 grid_3.4.4 iterators_1.0.9 labeling_0.3 gtable_0.2.0
[56] ModelMetrics_1.1.0 codetools_0.2-15 R6_2.2.2 dplyr_0.7.4 bindr_0.1
[61] rprojroot_1.3-2 stringi_1.1.6 Rcpp_0.12.15 rpart_4.1-13 DEoptimR_1.0-8
[66] tidyselect_0.2.4
Using RStudio as the IDE, version 1.1.442 gmad is a local package (does not have any conflicting function names, basically a package to access some private APIs).
Not sure if this is cause for concern - didn't encounter this on any previous installations. I've seen the answer for test.data.table() error message but it's for an older version and I am seeing multiple errors (vs one).
EDIT
Restarted RStudio, test run fines when no packages (other than base) are loaded (not even data.table).
Get errors after loading some packages.
I've copied the output for both cases. Too long to post in this question - here's a pastebin link and here's another for GoogleDrive.
Regarding my local package gmad:
NAMESPACE imports:
import(data.table)
import(ggplot2)
import(httr)
importFrom(lubridate,round_date)
DESCRIPTION imports:
Imports:
data.table,
lubridate,
ggplot2,
ggmap,
httr
All other packages are installed from CRAN (versions noted in the session info above).

data.table and lubridate use the same function names for some date/time-related functions so the order of loading both libraries decides which function from which package is called by the unit tests.
See this issue for details: https://github.com/Rdatatable/data.table/issues/1135
I think to test the correct installation of data.table you shouldn't load lubridate at all.
If you want to use date/time functions in your code you have to choose which masking is better for you and load the libraries in the desired order...
library(lubridate)
library(data.table)
test.data.table() # runs without errors
If you reset the R session and load data.table first you will get some unit test errors
library(data.table)
library(lubridate)
test.data.table() # runs with unit test errors
saying e. g.
Running test id 546 Test 546 ran without errors but failed check that
x equals y:

Related

eval trouble into R package

I have been making a package to upload to CRAN, but I have a little trouble.
If you go to the website, https://github.com/elflacosebas/migraR, you will find the package.
You can run the example to test it.
The problem comes when I want to avoid the attach and perform the best_migramod function. Then, it will use inside fit_migramod, which uses a class named Migramodel.
You can run the example now without the line codes below:
colnames(data1) <- c("x","y")
attach(data1)
The error I get says:
Error in eval(.self$expr, c(as.list(p), as.list(data))) :
object 'x' not finded
I have tried using attach and detach to solve it into the best_migradmod function but it doesn't work. I understand it is a matter of environment as this post says as well.
Error in eval(expr, envir, enclos) : object not found
Where shoud I put the attach? or the other operators, or should I modify the data file? or
Thanks a lot for the hint!!
In my laptop work the example without the two lines that you mentioned
sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)
Matrix products: default
Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Rounding
locale:
[1] LC_COLLATE=Spanish_Colombia.1252 LC_CTYPE=Spanish_Colombia.1252 LC_MONETARY=Spanish_Colombia.1252
[4] LC_NUMERIC=C LC_TIME=Spanish_Colombia.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] migraR_0.1.2 devtools_2.2.1 usethis_1.5.1 dplyr_0.8.3
loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 rstudioapi_0.10 magrittr_1.5 tidyselect_0.2.5 pkgload_1.0.2 R6_2.4.0
[7] rlang_0.4.2 tools_3.6.0 pkgbuild_1.0.6 sessioninfo_1.1.1 cli_1.1.0 withr_2.1.2
[13] remotes_2.1.0 ellipsis_0.3.0 rprojroot_1.3-2 assertthat_0.2.1 digest_0.6.20 tibble_2.1.3
[19] crayon_1.3.4 processx_3.4.1 purrr_0.3.3 callr_3.3.1 fs_1.3.1 ps_1.3.0
[25] curl_4.0 testthat_2.3.1 memoise_1.1.0 glue_1.3.1 compiler_3.6.0 pillar_1.4.2
[31] backports_1.1.4 desc_1.2.0 prettyunits_1.0.2 pkgconfig_2.0.2

Autoplot error when using ggcyto (Bioconductor) package: 'ggplot.data.frame' not found

I am running R-3.5.0 and RStudio 1.1.423 on Windows 7. I had to use our corporate installer for both programs, so I did not download the installer .exe files and am also limited in having the most recent version of the software.
I am trying to use the Bioconductor project FlowCore and ggcyto package to plot flow cytometry events. In the beginning this worked quite well, but recently (and I have no idea if I even changed anything) I cannot plot my flowframes using autoplot. Here's the example from the ggcyto documentation:
library(flowCore)
library(ggcyto)
data(GvHD)
fs <- GvHD[subset(pData(GvHD), Patient %in%5:7 & Visit %in% c(5:6))[["name"]]]
autoplot(fs, x = "SSC-H")
which results in
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) :
object 'ggplot.data.frame' not found
I noticed one strange thing: I cannot update the stringi package to the latest (I believe 1.2.3) version, only to 1.1.7.
It is suggested in this thread: R gives strange error with ggplot2 expression: object 'rversion' not found
that it is an RStudio problem. However, when running the same code in the R console without RStudio, I get the same error message.
Any help is greatly appreciated!
I found the source of the problem. Apparently I must have updated my packages and the latest ggplot2 release does not interact well with the ggcyto package.
A downgrade of ggplot2 to version 2.2.1 fixed it.
I ran into the exact same problem today running the most up-to-date R binaries and Rstudio version. I ended up using the package "flowViz" and the function: flowplot() to receive essentially the same result (just without the binning) as the autoplot() function of the "ggcyto" package utilized in the FlowCore Vignette. I hope this helps.
I am happy to report that this no longer fails in more recent R/BioC environments such as:
sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
Matrix products: default
BLAS: /n/apps/CentOS7/install/r-3.5.2/lib64/R/lib/libRblas.so
LAPACK: /n/apps/CentOS7/install/r-3.5.2/lib64/R/lib/libRlapack.so
locale:
[1] C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggcyto_1.10.2 flowWorkspace_3.30.2 ncdfFlow_2.28.1 BH_1.69.0-1 RcppArmadillo_0.9.400.3.0 ggplot2_3.1.1 flowCore_1.48.1 usethis_1.5.0 devtools_2.0.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 mvtnorm_1.0-10 lattice_0.20-38 corpcor_1.6.9 prettyunits_1.0.2 ps_1.3.0 assertthat_0.2.1 rprojroot_1.3-2 digest_0.6.18 R6_2.4.0 plyr_1.8.4 backports_1.1.4 stats4_3.5.2 pcaPP_1.9-73 pillar_1.4.0 zlibbioc_1.28.0 rlang_0.3.4 lazyeval_0.2.2 data.table_1.12.2 Rgraphviz_2.26.0 callr_3.2.0 hexbin_1.27.3 labeling_0.3 desc_1.2.0 stringr_1.4.0 munsell_0.5.0 compiler_3.5.2 pkgconfig_2.0.2 BiocGenerics_0.28.0
[30] pkgbuild_1.0.3 IDPmisc_1.1.19 tidyselect_0.2.5 gridExtra_2.3 tibble_2.1.1 matrixStats_0.54.0 XML_3.98-1.19 flowViz_1.46.1 rrcov_1.4-7 crayon_1.3.4 dplyr_0.8.1 withr_2.1.2 MASS_7.3-51.4 grid_3.5.2 gtable_0.3.0 magrittr_1.5 scales_1.0.0 graph_1.60.0 KernSmooth_2.23-15 stringi_1.4.3 cli_1.1.0 fs_1.3.1 remotes_2.0.4 testthat_2.1.1 latticeExtra_0.6-28 robustbase_0.93-5 RColorBrewer_1.1-2 tools_3.5.2 Biobase_2.42.0
[59] glue_1.3.1 DEoptimR_1.0-8 purrr_0.3.2 processx_3.3.1 pkgload_1.0.2 parallel_3.5.2 colorspace_1.4-1 cluster_2.0.9 sessioninfo_1.1.1 memoise_1.1.0

Error in loading package SASxport: object ‘label<-.data.frame’ is not exported by 'namespace:Hmisc'

I'm trying to read data in the XPT format into R (the format can be found for example in the NHANES data). I found two functions doing this:
library("Hmisc")
sasxport.get("C:/path/file.XPT")
and
library("SASxport")
read.xport("C:/path/file.XPT")
The sasxport.get works, so I'm basically fine, but still inquisitive enough to understand (and solve) the following error: after the installation of the SASxport package, I cannot load it. When I run library("SASxport"), I get the error message:
Error: package or namespace load failed for ‘SASxport’:
object ‘label<-.data.frame’ is not exported by 'namespace:Hmisc'
Adopting this suggestion, I also ran
remove.packages(c("SASxport", "Hmisc"))
install.packages('Hmisc', dependencies = TRUE)
install.packages('SASxport', dependencies = TRUE)
what did not change the error message.
This is my sessionInfo():
R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Hmisc_4.1-1 ggplot2_2.2.1 Formula_1.2-2 survival_2.41-3 lattice_0.20-35
loaded via a namespace (and not attached):
[1] Rcpp_0.12.14 pillar_1.0.1 compiler_3.4.3 RColorBrewer_1.1-2 plyr_1.8.4
[6] base64enc_0.1-3 iterators_1.0.9 tools_3.4.3 rpart_4.1-11 digest_0.6.13
[11] tibble_1.4.1 gtable_0.2.0 htmlTable_1.11.1 checkmate_1.8.5 rlang_0.1.6
[16] icenReg_2.0.7 Matrix_1.2-12 foreach_1.4.4 rstudioapi_0.7 yaml_2.1.16
[21] gridExtra_2.3 coda_0.19-1 stringr_1.2.0 cluster_2.0.6 knitr_1.18
[26] htmlwidgets_0.9 grid_3.4.3 nnet_7.3-12 data.table_1.10.4-3 foreign_0.8-69
[31] latticeExtra_0.6-28 magrittr_1.5 scales_0.5.0 backports_1.1.2 codetools_0.2-15
[36] htmltools_0.3.6 splines_3.4.3 colorspace_1.3-2 stringi_1.1.6 acepack_1.4.1
[41] lazyeval_0.2.1 munsell_0.4.3
The last update of SASxport happend nearly two years ago (2016-03-11). So the Hmisc package it imports might have changed in the meantime. Looking up the Hmisc archive I found the version number on 2016-03-11 to be 3.17-2. So installing this version fixes the problem:
library("devtools")
install_version("Hmisc", version = "3.17-2")
Two reasons speak against using SASxport in this case:
You need to use a old version of a package which might happer your work in later steps.
SASxport needs Hmisc for a task that Hmisc can do already by itself, so SASxport is expendable when reading in XPT files.

GO.db - Get newest Gene Ontology annotations

I am using the GO.db package in R (v3.3.2) to access information about the Gene Ontology. I can see by running the GO.db command that my annotations are outdated. (I know there are a newer set of annotations released in 2017).
> GO.db
GODb object:
| GOSOURCENAME: Gene Ontology
| GOSOURCEURL: ftp://ftp.geneontology.org/pub/go/godatabase/archive/latest-lite/
| GOSOURCEDATE: 2016-Sep21
| Db type: GODb
| package: AnnotationDbi
| DBSCHEMA: GO_DB
| GOEGSOURCEDATE: 2016-Sep26
| GOEGSOURCENAME: Entrez Gene
| GOEGSOURCEURL: ftp://ftp.ncbi.nlm.nih.gov/gene/DATA
| DBSCHEMAVERSION: 2.1
I've tried uninstalling and reinstalling the package, but the GOSOURCEDATE value remains unchanged.
I want to find out what sequence of R commands will allow me to load the newer annotations. Do I need to install a newer version of R?
The Bioconductor version information is as follows:
> BiocInstaller::biocLite()
BioC_mirror: https://bioconductor.org
Using Bioconductor 3.4 (BiocInstaller 1.24.0), R 3.3.2 (2016-10-31).
The output of the sessionInfo command is as follows (includes a lot of unrelated packages that my application also loads.
> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_Canada.1252 LC_CTYPE=English_Canada.1252 LC_MONETARY=English_Canada.1252
[4] LC_NUMERIC=C LC_TIME=English_Canada.1252
attached base packages:
[1] parallel stats4 stats graphics grDevices utils datasets methods base
other attached packages:
[1] cowplot_0.8.0 ggplot2_2.2.1 xlsx_0.5.7 xlsxjars_0.6.1 rJava_0.9-8
[6] reshape2_1.4.2 metap_0.8 GO.db_3.4.0 annotate_1.52.1 XML_3.98-1.9
[11] org.Hs.eg.db_3.4.0 AnnotationDbi_1.36.2 IRanges_2.8.2 S4Vectors_0.12.2 Biobase_2.34.0
[16] BiocGenerics_0.20.0 homologene_1.0 magrittr_1.5 tidyr_0.7.1 dplyr_0.7.3
[21] readr_1.1.1 tmod_0.31
loaded via a namespace (and not attached):
[1] beeswarm_0.2.3 purrr_0.2.3 lattice_0.20-34 colorspace_1.3-2 htmltools_0.3.6 blob_1.1.0
[7] rlang_0.1.2 glue_1.1.1 DBI_0.7 bit64_0.9-7 RColorBrewer_1.1-2 bindrcpp_0.2
[13] bindr_0.1 plyr_1.8.4 pca3d_0.10 stringr_1.2.0 munsell_0.4.3 gtable_0.2.0
[19] htmlwidgets_0.9 memoise_1.1.0 knitr_1.17 httpuv_1.3.5 Rcpp_0.12.12 xtable_1.8-2
[25] scales_0.5.0 jsonlite_1.5 mime_0.5 bit_1.1-12 ellipse_0.3-8 hms_0.3
[31] digest_0.6.12 stringi_1.1.5 tagcloud_0.6 shiny_1.0.5 grid_3.3.2 tools_3.3.2
[37] bitops_1.0-6 rgl_0.98.1 lazyeval_0.2.0 RCurl_1.95-4.8 tibble_1.3.4 RSQLite_2.0
[43] pkgconfig_2.0.1 assertthat_0.2.0 R6_2.2.2 plotwidgets_0.4
I couldn't find your question on the support site, so I can give you one here.
It seems that you are using Bioconductor version 3.4. It appears that all of your annotation packages are out-of-date. If you want to use the current release annotations, you will have to update your version of R to the current release version (3.4.1) and then run the command BiocInstaller::biocLite("biocUpgrade").

Installed caret in R but unable to use in library

This is the code and error message I am getting:
> library(caret)
Error : object ‘semester’ is not exported by 'namespace:lubridate'
Error: package or namespace load failed for ‘caret’
I am using a mac. I also use this at work on a PC and haven't had any problems.
I also ran sessionInfo() as adivsed
> sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X Yosemite 10.10.5
locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lattice_0.20-34 factoextra_1.0.5 FactoMineR_1.36 e1071_1.6-8
[5] GGally_1.3.0 ggrepel_0.6.5 RColorBrewer_1.1-2 stringr_1.2.0
[9] tidyr_0.6.1 dplyr_0.7.3 data.table_1.10.4 ggplot2_2.2.1
loaded via a namespace (and not attached):
[1] reshape2_1.4.1 kernlab_0.9-25 splines_3.3.3
[4] colorspace_1.3-2 prodlim_1.6.1 survival_2.40-1
[7] rlang_0.1.2 ModelMetrics_1.1.0 glue_1.1.1
[10] bindrcpp_0.2 foreach_1.4.3 bindr_0.1
[13] plyr_1.8.4 lava_1.5 dimRed_0.1.0
[16] robustbase_0.92-7 timeDate_3012.100 munsell_0.4.3
[19] gtable_0.2.0 leaps_3.0 codetools_0.2-15
[22] class_7.3-14 DEoptimR_1.0-8 Rcpp_0.12.9
[25] scales_0.4.1 flashClust_1.01-2 ipred_0.9-6
[28] scatterplot3d_0.3-40 CVST_0.2-1 stringi_1.1.2
[31] RcppRoll_0.2.2 ddalpha_1.2.1 grid_3.3.3
[34] tools_3.3.3 magrittr_1.5 lazyeval_0.2.0
[37] tibble_1.3.4 cluster_2.0.5 DRR_0.0.2
[40] pkgconfig_2.0.1 MASS_7.3-45 Matrix_1.2-8
[43] lubridate_1.5.6 gower_0.1.2 assertthat_0.1
[46] reshape_0.8.6 iterators_1.0.8 R6_2.2.0
[49] rpart_4.1-10 nnet_7.3-12 nlme_3.1-131
You may have outdated dependencies. Try updating all installed packages. Then install "caret" with all dependencies : (install.packages("caret", dependencies = TRUE)). Worked for me!
I just ran into the same issue, except I got stuck at updating (reinstalling) the lubridate package. Some of the errors I got looked something like:
./cctz/include/civil_time_detail.h:37: error: expected nested-name-specifier before ‘year_t’
./cctz/include/civil_time_detail.h:37: error: ‘year_t’ has not been declared
./cctz/include/civil_time_detail.h:37: error: expected ‘;’ before ‘=’ token
./cctz/include/civil_time_detail.h:37: error: expected unqualified-id before ‘=’ token
turned out my gcc compiler (running RHEL 6.8) was too old (4.4.7). Since I couldn't upgrade the compiler itself, I installed a devtoolset.
then, I fixed my problem by enabling the devtoolset before running R:
scp enable devtoolset-4 R

Resources