New bug in glmmADMB? VarCorr can't locate rdig - r

I think this is a newly introduced bug. At the very least, it bugged previously working code.
library(glmmADMB)
epil2$subject <- factor(epil2$subject)
fm <- glmmadmb(y~Base*trt+Age+Visit+(Visit|subject),
data=epil2, family="nbinom")
VarCorr(fm)
Produces the following error:
Error in glmmADMB::VarCorr(fm) :
could not find symbol "rdig" in environment of the generic function
VarCorr from nlme still works fine:
library(nlme)
nlme::VarCorr(fm) ##WORKS
glmmADMB::VarCorr(fm) ##Still doesn't work.
Here is my systemInfo if that helps:
> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] nlme_3.1-125 glmmADMB_0.8.1 MASS_7.3-45
loaded via a namespace (and not attached):
[1] Matrix_1.2-3 plyr_1.8.3 magrittr_1.5 tools_3.2.3
[5] coda_0.18-1 Rcpp_0.12.3 stringi_1.0-1 grid_3.2.3
[9] stringr_1.0.0 R2admb_0.7.13 lattice_0.20-33

I found a solution to my problem. I used the installation code provided here:
http://glmmadmb.r-forge.r-project.org/ . I am not sure if it was necessary but before running the below code I navigated to my ~R/R-3.2.3/library folder and deleted the glmmADMB folder.
Then I ran the code below.
install.packages("R2admb")
install.packages("glmmADMB",
repos=c("http://glmmadmb.r-forge.r-project.org/repos",
getOption("repos")),
type="source")
This updated my glmmADMB to version 0.8.3.3 which corrected the error (by turning it into a warning).

Related

Error in inla.call.builtin() : INLA installation error; no such file

I have recently updated INLA using the inla.update on my machine. Now everytime I try to run a function from the package, such as inla.mesh.2d I obtain the following error:
Error in inla.call.builtin() : INLA installation error; no such file
I tried uninstalling and reinstalling INLA package both in its testing and stable version but it still won't work.
I will paste below the output from sessionInfo():
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] it_IT.UTF-8/it_IT.UTF-8/it_IT.UTF-8/C/it_IT.UTF-8/it_IT.UTF-8
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] INLA_22.01.16 sp_1.4-5 foreach_1.5.1 Matrix_1.3-4
loaded via a namespace (and not attached):
[1] compiler_4.0.3 tools_4.0.3 tinytex_0.32 splines_4.0.3 codetools_0.2-18 grid_4.0.3
[7] iterators_1.0.13 xfun_0.23 lattice_0.20-44
Thank You!
The error you are getting may solve if you update your R to its latest version so INLA requirements are met. Restart, and it may resolve.
If this does not resolve the problem, installing directly from the R interface (vs RStudio) might fix the problem. This link explains how it is done and might be helpful if the first solution did not help.
https://groups.google.com/g/r-inla-discussion-group/c/f3LAE2VHZQw

Error in as.POSIXlt.POSIXct(x, tz) : (converted from warning) unknown timezone 'GMT'

I find myself confronted with a problem for which I fail to find a clue to a solution - which makes it very hard to actually deal with it.. Here goes: In R (with R-Studio) I try to create a Date object with the library lubridate:
library(lubridate)
ymd(20161001)
which results in an error:
Error in as.POSIXlt.POSIXct(x, tz) :
(converted from warning) unknown timezone 'GMT'
A second run (and any subsequent runs) of the last command yields the correct result:
ymd(20161001)
[1] "2016-01-01"
until I restart my R-session, when again the first run triggers an error. I've checked several settings, but can't find anything changing from the first to the second run. Here's, for instance, the output of my sessionInfo():
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=Dutch_Netherlands.1252 LC_CTYPE=Dutch_Netherlands.1252 LC_MONETARY=Dutch_Netherlands.1252 LC_NUMERIC=C
[5] LC_TIME=Dutch_Netherlands.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lubridate_1.6.0
loaded via a namespace (and not attached):
[1] magrittr_1.5 tools_3.3.2 stringi_1.1.2 stringr_1.1.0
Sys.timezone() says [1] "Europe/Berlin", and Sys.getenv('TZ') is empty: ""
I do find others stumbling upon the same warning, such as this blogpost or here, but these problems have to do with times, whereas I would prefer to ignore times altogether, and deal with dates only.
I was getting the same error today. My code was in an Rmarkdown file set to output as a tufte_html document. I was loading the following packages:
library(lubridate)
library(tidyverse)
library(stringr)
library(extrafont)
library(extrafontdb)
library(tufte)
To get my code working I did the following:
First, I got off my company's VPN, suspecting that maybe it was the problem, but I was still getting the error when using my home wifi and no VPN. Next, I updated all my packages but was still getting the error.
Then, I shut down my Macbook and rebooted but was still getting the error.
Finally, I changed my script to no longer load tidyverse as a whole but instead load:
library(lubridate)
library(tibble)
library(dplyr)
library(readr)
library(extrafont)
library(extrafontdb)
library(tufte)
Then my Rmarkdown file rendered to html without the unknown timezone error. Unfortunately, I cannot pinpoint what exactly fixed the error or why loading parts but not the whole tidyverse seemed to do the trick for me. Did you ever solve your problem?
My session info when it worked:
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.1
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.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] tufte_0.2 extrafontdb_1.0 extrafont_0.17 stringr_1.2.0
[5] readr_1.1.1 dplyr_0.7.4 tibble_1.3.4 lubridate_1.7.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.13 Rttf2pt1_1.3.4 knitr_1.17 bindr_0.1
[5] magrittr_1.5 hms_0.3 R6_2.2.2 rlang_0.1.4
[9] tools_3.4.2 htmltools_0.3.6 yaml_2.1.14 rprojroot_1.2
[13] digest_0.6.12 assertthat_0.2.0 bindrcpp_0.2 glue_1.2.0
[17] evaluate_0.10.1 rmarkdown_1.8 stringi_1.1.6 compiler_3.4.2
[21] backports_1.1.1 pkgconfig_2.0.1
The answer to this question worked for me.
I added Sys.setenv(TZ='America/Detroit') to my script, for example.
The solution presented here R error: unknown timezone with as.POSIXct()
In my case, after including Sys.setenv(TZ="America/Lima") at the beginning of the code everything works fine.
Please check the list of valid TZ values at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

rJava gives a NullPointerException in .jcall

I am trying to run a standard corpus loading method in the mallet R package and more specifically
instance <- mallet.import(names(txt$CELEX), txt$TEXT, stoplist.file = "stopwords.en.txt", token.regexp = "\\p{L}[\\p{L}\\p{P}]+\\p{L}")
Then I get the following error
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, :
java.lang.NullPointerException
which seems to me more like an rJava error more than anything else. My sysinfo follows:
R version 3.3.0 (2016-05-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=Danish_Denmark.1252 LC_CTYPE=Danish_Denmark.1252 LC_MONETARY=Danish_Denmark.1252
[4] LC_NUMERIC=C LC_TIME=Danish_Denmark.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] mallet_1.0 XLConnect_0.2-12 XLConnectJars_0.2-12 quanteda_0.9.6-9 rJava_0.9-8
[6] topicmodels_0.2-4
loaded via a namespace (and not attached):
[1] Rcpp_0.12.5 lattice_0.20-33 slam_0.1-35 chron_2.3-47 grid_3.3.0 stats4_3.3.0
[7] stringi_1.1.1 data.table_1.9.6 NLP_0.1-9 ca_0.64 Matrix_1.2-6 tools_3.3.0
[13] parallel_3.3.0 tm_0.6-2 modeltools_0.2-21
I use Java 8 in case it matters. I read somewhere that rJava is not playing well with Java 8
That's not the usual error from rJava problems, which seem to have settled down.
One possible problem could be that the stoplist file does not exist or is not in the right place.

auto_test gives reporter error in testthat

I'm trying to force myself to do more unit testing on some data analysis projects where I don't really want to develop a package. So, I've been playing with the testthat R package. I have a code folder and inside it is a src and a test folder. In the src folder I have the file add.R that has this function:
add <- function(x,y){
x+y
}
In the test folder I have the file test-add.R that contains this:
library(testthat)
test_that("adding numbers", {
expect_equal(add(2,3), 5)
expect_equal(add(5,5), 10)
})
The following works fine...
> source('code/src/add.R')
> test_file('code/test/test-add.R')
But I'd like to be able to use the auto_test function since as the project grows source/test_file will get tedious. But when I try auto_test I get this...
> auto_test('code/src', 'code/test')
Error in find_reporter(reporter) : attempt to apply non-function
I'm sure I'm missing something simple, but what?
> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.1 (El Capitan)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] testthat_0.11.0.9000 knitr_1.12.3
loaded via a namespace (and not attached):
[1] lazyeval_0.1.10 R6_2.1.2 tools_3.2.3
[4] withr_1.0.1 memoise_1.0.0 crayon_1.3.1
[7] digest_0.6.9 devtools_1.10.0.9000
It seems that this is a problem of testthat version 0.11.0.9000. If I install this version from github, I get the same error message as you do:
auto_test('code/src', 'code/test')
## Error in find_reporter(reporter) : attempt to apply non-function
But with version 0.11.0 that can be installed from CRAN, your example runs fine:
auto_test('code/src', 'code/test')
## ..
## DONE

pander $add function not working

I was able to use pander successfully this morning on one computer, but now I am trying to do it on my own computer, and I am having some weird issues.
Here is my very elementary R Pander code:
library("pander")
library("knitr")
test<-Pandoc$new("My Name","Test")
test$add.paragraph('# Welcome to Test')
test$add.paragraph('*****')
#works so far but here it won't work
test$add(3+3)
#here I get error in dev.control(displaylist = "enable"):
# dev.control() called without an open grpahics device
# In addition: Warning message:
#In png("plots/....png", width=480,height=480,res=72, : failed to load cairo DLL
I literally can't use $add to add R code, and I don't understand why. I would greatly appreciate if someone could help.
Regards
edit:
R version 3.2.1 (2015-06-18)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.4 (Yosemite)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] knitr_1.10.5 rmarkdown_0.7 rapport_0.51 yaml_2.1.13 plyr_1.8.3 lattice_0.20-33 pander_0.5.2 brew_1.0-6
loaded via a namespace (and not attached):
[1] htmltools_0.2.6 tools_3.2.1 Rcpp_0.12.0 reshape_0.8.5 grid_3.2.1 digest_0.6.8
It appears I did not have XQuartz installed. I installed it and everything works so thank you and köszönöm for the help.

Resources