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
Related
This issue shook me. Lets a minimal reproducible example:
On RStudio, create a New Project... Choose Shiny Web App. Check that sample app runs well.
Create inside the standard R folder, to put all your *.R scripts.
Create a dummy script inside the R folder that fails, but you do not want run yet. For example
str(do_not_exist) ## foo.R
4.Run the App again. Now, the App fails
> runApp()
Error in str(do_not_exist) : objeto 'do_not_exist' no encontrado
Why Shiny runs undesirable scripts? They are OUT of the root directory.
I am not finding ways to save scripts that are not functions within the project.
This is my R Session
> sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=Spanish_Argentina.1252 LC_CTYPE=Spanish_Argentina.1252
[3] LC_MONETARY=Spanish_Argentina.1252 LC_NUMERIC=C
[5] LC_TIME=Spanish_Argentina.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] tidyr_1.1.3 dplyr_1.0.5 openxlsx_4.2.3.9000 shiny_1.6.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.6 magrittr_2.0.1 tidyselect_1.1.0 xtable_1.8-4
[5] R6_2.5.0 rlang_0.4.10 fastmap_1.1.0 fansi_0.4.2
[9] tools_4.0.5 utf8_1.2.1 DBI_1.1.1 withr_2.4.2
[13] htmltools_0.5.1.1 ellipsis_0.3.1 assertthat_0.2.1 digest_0.6.27
[17] tibble_3.1.1 lifecycle_1.0.0 crayon_1.4.1 zip_2.1.1
[21] purrr_0.3.4 later_1.1.0.1 vctrs_0.3.7 promises_1.2.0.1
[25] glue_1.4.2 mime_0.10 stringi_1.5.3 compiler_4.0.5
[29] pillar_1.6.0 generics_0.1.0 httpuv_1.5.5 pkgconfig_2.0.3
See here. One option is options(shiny.autoload.r = FALSE).
My RStudio crashed a number of times with the following error:
Error in (function (srcref) : unimplemented type (29) in 'eval'
The similarities where this has happened were:
I was working in a Markdown Notebook
I believe it was always when I selected the "Run all chunks above" command
I had run some code chunks in the current session before (so it wasn't upon starting work)
The error was always displayed just before the RStudio session aborted. I lose all my data and variables in the environment, but most of the code seems to be recoverable.
Anyone with an idea of what might cause this or how to deal with it?
Here my SessionInfo
R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] data.table_1.12.8 forcats_0.5.0 stringr_1.4.0 dplyr_0.8.5 purrr_0.3.4 readr_1.3.1
[7] tidyr_1.0.2 tibble_3.0.0 ggplot2_3.3.0 tidyverse_1.3.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.4.6 cellranger_1.1.0 pillar_1.4.3 compiler_4.0.0 dbplyr_1.4.3 tools_4.0.0 packrat_0.5.0
[8] lubridate_1.7.8 jsonlite_1.6.1 lifecycle_0.2.0 nlme_3.1-147 gtable_0.3.0 lattice_0.20-41 pkgconfig_2.0.3
[15] rlang_0.4.5 reprex_0.3.0 cli_2.0.2 DBI_1.1.0 rstudioapi_0.11 haven_2.2.0 xfun_0.13
[22] withr_2.2.0 xml2_1.3.1 httr_1.4.1 knitr_1.28 fs_1.4.1 hms_0.5.3 generics_0.0.2
[29] vctrs_0.2.4 grid_4.0.0 tidyselect_1.0.0 glue_1.4.0 R6_2.4.1 fansi_0.4.1 readxl_1.3.1
[36] modelr_0.1.6 magrittr_1.5 backports_1.1.6 scales_1.1.0 ellipsis_0.3.0 rvest_0.3.5 assertthat_0.2.1
[43] colorspace_1.4-1 stringi_1.4.6 munsell_0.5.0 broom_0.5.6 crayon_1.3.4
I sadly can't give you a reproducible example, but this is a screenshot of the last time it happened:
And the next time following a fairly simple ggplot command:
You might try updating Rstudio.
I had similar messages that started to occur after I updated to version 4.0.0 of R. These errors were occurring with code that presented no problems on previous versions of R. I could run the code line by line with Ctrl-Enter with no error, but running the whole chunk would be a problem.
The issue went away when I updated Rstudio from Version 1.1.463 to 1.2.5042.
strange behaviour I noticed in my RStudio installation:
Help search via the double question mark (e.g., ??gg) does not work in RStudio. It gives me "No results found" in the Help pane.
Help search via the upper search field in the Help pane works as intended and returns results for the example search above.
?? works in the Mac OS R GUI ("R.app"), it opens a browser tab with the results page.
Single question mark ? works also in RStudio (but of course only with exact matches to names).
Does anybody know how to resolve this? Thanks!
EDIT: My sessionInfo():
R version 3.6.0 (2019-04-26)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
locale:
[1] de_DE.UTF-8/de_DE.UTF-8/de_DE.UTF-8/C/de_DE.UTF-8/de_DE.UTF-8
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] jsonlite_1.6 scales_1.0.0 tidyr_0.8.3 ggplot2_3.2.0 koRpus.lang.de_0.1-1 koRpus_0.11-5
[7] sylly_0.1-5 readxl_1.3.1 data.table_1.12.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 highr_0.8 cellranger_1.1.0 pillar_1.4.1 compiler_3.6.0 tools_3.6.0 zeallot_0.1.0
[8] digest_0.6.19 tibble_2.1.3 gtable_0.3.0 pkgconfig_2.0.2 rlang_0.4.0 cli_1.1.0 rstudioapi_0.10
[15] curl_3.3 yaml_2.2.0 xfun_0.8 knitr_1.23 withr_2.1.2 dplyr_0.8.1 vctrs_0.1.0
[22] grid_3.6.0 tidyselect_0.2.5 sylly.de_0.1-2 glue_1.3.1 R6_2.4.0 fansi_0.4.0 purrr_0.3.2
[29] magrittr_1.5 backports_1.1.4 fortunes_1.5-4 assertthat_0.2.1 colorspace_1.4-1 labeling_0.3 utf8_1.1.4
[36] lazyeval_0.2.2 munsell_0.5.0 crayon_1.3.4
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:
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.