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
Related
To avoid problems when using R and RStudio, can R be configured to work with utf-8 by default? My system is windows 10 64 bit, R scripts are saved as ANSI, however when opening those same files with RStudio there are problems with the Latin characters, ñ, tildes, euro symbol €. I have to convert the files to change the character encoding, so that I can use them with RStudio.
From the R console:
> 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_Spain.1252 LC_CTYPE=Spanish_Spain.1252
[3] LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C
[5] LC_TIME=Spanish_Spain.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.5
In RStudio go to Tools bar, then click Global options (at the bottom):
See picture below: Click Code, then Saving -> you can set default text encoding
I'm running some very simple code:
library(opencv)
ocv_video(ocv_face)
And the session immediately aborts.
Any ideas? (note: running R 4.0.2)
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.5
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
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] opencv_0.1
loaded via a namespace (and not attached):
[1] compiler_4.0.2 magrittr_1.5 tools_4.0.2 Rcpp_1.0.4.6
Solution
For anyone else who arrives here, the solution is to run the same code from terminal. That is press cmd + space to bring up spotlight search, type terminal to open terminal. Type R to open the R interpreter, and use that instead of RStudio.
Cause of the crash
The reason it works from terminal but no RStudio is because from terminal, a prompt will appear asking you to give opencv permission to use your webcam, but this prompt will not appear in RStudio (it causes the crash).
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
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()
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)
}