Graphics API version mismatch - r

I have a big problem
I update R to the latest version.
After updating, every time i try to plot something with whatsoever kind of graphic function( even with the basic plot) i get this error
Error: Graphics API version mismatch
these are my session info
R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=Italian_Italy.1252
[2] LC_CTYPE=Italian_Italy.1252
[3] LC_MONETARY=Italian_Italy.1252
[4] LC_NUMERIC=C
[5] LC_TIME=Italian_Italy.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
loaded via a namespace (and not attached):
[1] compiler_3.3.2 tools_3.3.2
Note: no visible binding for global variable 'x'
Note: no visible binding for global variable 'envir'
All packages installed are updated to the latest version available

Related

R 3.6.3 faster than R 4.2.2?

I am not sure wether this is the right place for this question, but I've upgraded my R from 3.6.3 to 4.2.2 and my experience has been that the 4.2.2 version is way slower than the older one in some cases. Is this really an issue with R 4.x compared to R 3.6.x or do I need to adjust anything on my setup?
I found this link regarding a problem similar to mine with R 4.0.2: https://github.com/rocker-org/rocker/issues/412
Sample code (runs on average twice as fast on 3.6.3 than on 4.2.2)
I know this could be a package implementation issue rather than an R version issue, but I had problems with other scripts that do not use any of the packages below
library(tictoc)
library(seasonal)
times <- c()
for(j in 1:100) {
print(j)
tic()
for(i in 1:20) {
try({ final(seas(ts(1:120 + runif(120), start = c(1990, 1), frequency = 12))) })
}
elapsed <- toc()
times <- c(elapsed, unname(elapsed$toc - elapsed$tic))
}
Other informations:
→ Everything ran on the same machine
Session Info for 3.6.3
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)
Matrix products: default
locale:
[1] LC_COLLATE=Portuguese_Brazil.1252 LC_CTYPE=Portuguese_Brazil.1252 LC_MONETARY=Portuguese_Brazil.1252 LC_NUMERIC=C LC_TIME=Portuguese_Brazil.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] seasonal_1.9.0 tictoc_1.0
loaded via a namespace (and not attached):
[1] x13binary_1.1.39-2 compiler_3.6.3 tools_3.6.3
Session Info for 4.2.2
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)
Matrix products: default
locale:
[1] LC_COLLATE=Portuguese_Brazil.utf8 LC_CTYPE=Portuguese_Brazil.utf8 LC_MONETARY=Portuguese_Brazil.utf8 LC_NUMERIC=C
[5] LC_TIME=Portuguese_Brazil.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] seasonal_1.9.0 tictoc_1.1
loaded via a namespace (and not attached):
[1] colorspace_2.1-0 scales_1.2.1 x13binary_1.1.57-3 compiler_4.2.2 R6_2.5.1 cli_3.6.0 tools_4.2.2 rstudioapi_0.14
[9] lifecycle_1.0.3 munsell_0.5.0 rlang_1.0.6

Rstudio multiline commenting shortcut does not do anything

As the title says, I normally use ctrl + shift + c to comment out multiple lines of code in Rstudio. It no longer works (nothing happens when I use the above shortcut).
I am using Rstudio version:
2022.02.3 Build 492
"Prairie Trillium" Release (1db809b8, 2022-05-20) for Windows
Session info:
R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_New Zealand.1252 LC_CTYPE=English_New Zealand.1252 LC_MONETARY=English_New Zealand.1252 LC_NUMERIC=C
[5] LC_TIME=English_New Zealand.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.1.1 tools_4.1.1
I have had look in "Global options" but cannot see any setting relating to multiline commenting and in the "keyboard shortcuts help" section it still lists ctrl + shift + c as the correct shortcut. Anyone know what my issue could be?

Rterm.exe error in RStudio

I am using R 3.2.2 and RStudio 0.99.486 (latest version) under Windows 7 SP1 64 bit. I always get an error when I start RStudio:
the procedure entry point vsnprintf could not be
located in the dynamic link library R.dll
But I don't get any errors when I directly start R 3.2.2.
The R installed into C:/ProgramFiles/R/R-3.2.2/ (not the default path) and don't have other versions of R. RStudio is setup to use the installed R.
Except I get an error in RStudio, all my R codes can run in RGUI and RStudio.
Thanks for any suggestions to solve this annoying problem.
My session information
sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.2.2
> .libPaths()

How to read extra-ASCII characters in R?

I am reading input text file line by line with the following function:
lines_reader<-function(filename){
conn<-file(filename,open="r")
linn<-readLines(conn,encoding="UCS-2LE")
close(conn)
return(linn)
}
If I try to plot these lines in the R enviroment, letters with accent marks are treated not adequately appearing like "Ã" or "è" instead of "à" or "è".
How to cope with this? What encoding I should choose?
Here they are my session and local system info:
> sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)
locale:
[1] LC_COLLATE=Italian_Italy.1252 LC_CTYPE=Italian_Italy.1252
[3] LC_MONETARY=Italian_Italy.1252 LC_NUMERIC=C
[5] LC_TIME=Italian_Italy.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.2.0
> Sys.getlocale()
[1] "LC_COLLATE=Italian_Italy.1252;LC_CTYPE=Italian_Italy.1252;LC_MONETARY=Italian_Italy.1252;LC_NUMERIC=C;LC_TIME=Italian_Italy.1252"
How about changing the encoding that you are using:
lines_reader<-function(filename){
conn<-file(filename,open="r")
linn<-readLines(conn,encoding="UTF-8")
close(conn)
return(linn)
}

In Windows 7x64R: set ghost script environment variable

What am I missing here, it works on another PC. From R Im trying to use Sys.setenv() to invoke ghost script. Then, normally I can use tools::find_gs_cmd() to check that it is set.
Heres the ghostscript exe:
> dir("C:/Program Files/gs/gs9.16/bin/")
[1] "gsdll64.dll" "gsdll64.lib" "gswin64.exe" "gswin64c.exe"
But when I try to set it I think it does NOT do it:
> Sys.setenv(R_GSCMD="C:/Program Files/gs/gs9.16/bin/gswin64c.exe")
> tools::find_gs_cmd("gswin64c.exe")
gswin64c.exe
""
If I use Sys.getenv() it is there on the list of environment variable all right, so Im a little unsure what is happening.
My system is:
> sessionInfo()
R version 3.1.3 (2015-03-09)
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 LC_NUMERIC=C
[5] LC_TIME=Danish_Denmark.1252
attached base packages:
[1] tools stats graphics grDevices utils datasets methods base

Resources