Why am I not having any problems with the lastest versions of R and Rstudio? - r

I am using the latest versions of R and Rstudio and I am doing my work exclusively on Rstudio. The info about my OS and R version:
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.1.0 tools_4.1.0
More detailed info about the R version:
> version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 4
minor 1.0
year 2021
month 05
day 18
svn rev 80317
language R
version.string R version 4.1.0 (2021-05-18)
nickname Camp Pontanezen
In Rstudio when I go to Help > Check for Updates I get this:
Or using versionInfo:
> library(rstudioapi)
> versionInfo()[2:4] # ignoring the `$citation` which is not necessary for this question
$mode
[1] "desktop"
$version
[1] ‘1.4.1103’
$release_name
[1] "Wax Begonia"
One of the main problems that people are having is the ggplot2 related problems. Seems like people cannot produce ggplot2 plots with the newest version of R on the newest version of Rstudio. But this works perfectly fine for me. For example:
> library(ggplot2)
> ggplot(mtcars, aes(hp, mpg)) + geom_point()
Why this would be the case? And should I be worried about my current projects crashing all of a sudden and being not reproducible with the future updates?
Also, I am not sure if I should use the Preview version of Rstudio or keep using the current one in terms of my projects being safe.

This problem seems to be specific to Linux and macOS.
In this issue and all other reports of the bug I could find, Linux or macOS are specifically referenced. But there is not official confirmation, as far as I can see.
To confirm this theory then, I tested your code on my Ubuntu and Windows 10 machines: On Linux I experience the crash described in the issue. On Windows I had no problems.
As a further note, I experience this issue with your specific example but haven't noticed it since installing R 4.1.0 last week. Why? Because I rarely work with R scripts and the issue is apparently not affecting the Console or R Markdown (knitting or running just the chunk). Both have no problem running the example.
So I believe there is no need for you to update to the preview. For people on Unix systems, it looks a bit different. If you regularly use R scripts, you should consider the preview linked in the issue or switch to R Markdown.

Related

Could not open url 'http://cran.rstudio.com/bin/windows/contrib/4.2/PACKAGES'

When I install new version of Rstudio (the latest version: 2022.02.3-492),
many packages that were previously installed do not work.
enter image description here
Also, install.packages does not work due to "cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/4.2/PACKAGES'"
First, I checked getOption("repos") and it prints
CRAN
"http://cran.rstudio.com/"
attr(,"RStudio")
[1] TRUE
Next, checked sessionInfo(), and it prints
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)
Matrix products: default
locale:
[1] LC_COLLATE=Korean_Korea.utf8 LC_CTYPE=Korean_Korea.utf8
[3] LC_MONETARY=Korean_Korea.utf8 LC_NUMERIC=C
[5] LC_TIME=Korean_Korea.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.2.0 tools_4.2.0
Finally, checked my firewall blocker and allowed an application of RStudio R session.
However, none of them works.
It is making me crasy. How can I fix the problem?
In RStudio Go to Tools -> Global Options and in the Packages tab uncheck the box "use secure download method for HTTP".
Packages menu screenshot

R and R studio won't load aplpack

I am using R/Rstudio (version 4.0.3 - "Bunny-Wunnies Freak Out") and have installed the aplpack package. However, when I go to load the package, it just loads forever without actually activating the package. I'm currently running macOS Big Sur 11.2 and I have the latest version of XQuartz installed. To load the package, I am using
library(aplpack)
I saw that someone else has had a similar problem, but they were running a different OS and their question was never answered. I'm hoping someone out there can help.
UPDATE: As was requested in the comments, here is the Sys.info() and the sessionInfo() information:
`Sys.info()
sysname
"Darwin"
release
"20.3.0"
version
"Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64"`
`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
BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/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
loaded via a namespace (and not attached):
[1] compiler_4.0.3`
I was able to install and open the aplpack package (macOS Big Sur 11.2) using install.packages("aplpack"); library(aplpack) but it did take some time to load (~2 mins). I suspect your issue is related to xquartz. Xquartz no longer comes installed with macOS, so a likely solution to your problem is to install an up-to-date version of xquartz (https://www.xquartz.org/releases/) and ensure it can be opened from RStudio using x11()
If you want to reach the R - Mac experts,
a posting to the ("good old") R-SIG-Mac (R Special Interest Group # Mac) mailing list will reach them, notably the R Core team members involved:
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Fatal Error in R when using tcltk::tkentry

I recently upgraded my R to 4.0.1 from 3.4.1 because I needed to use the TSP package and hadn't updated R in a while. TSP only requires greater than 3.5.0 but I figured I would install the latest version, right?
Now, I'm trying to run code I use daily for the past several years but am getting a fatal error in both R Studio and the R console. It uses the tcltk library to store username and password, which is crucial as I pull in SQL data from our server to utilize in my code. I don't want to store my credentials in the code, and it's a hassle as our passwords change monthly.
I've tried looking at other questions, such as Fatal Error After Upgrading R / R Studio but that doesn't seem to be the problem.
Here's my sessionInfo():
R version 4.0.1 (2020-06-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.1 tools_4.0.1
I suspect that tcltk::tkentry is the issue, as I went line by line and that's what causes the fatal error.
Here's my function:
getLoginDetails <- function(){
## Based on code by Barry Rowlingson
## http://r.789695.n4.nabble.com/tkentry-that-exits-after-RETURN-tt854721.html#none
require(tcltk)
tt <- tktoplevel()
tkwm.title(tt, "Get login details")
Name <- tclVar("Login ID")
Password <- tclVar("Password")
entry.Name <- tkentry(tt,width="20", textvariable=Name)
entry.Password <- tkentry(tt, width="20", show="*",
textvariable=Password)
tkgrid(tklabel(tt, text="Please enter your login details."))
tkgrid(entry.Name)
tkgrid(entry.Password)
OnOK <- function()
{
tkdestroy(tt)
}
OK.but <-tkbutton(tt,text=" OK ", command=OnOK)
tkbind(entry.Password, "<Return>", OnOK)
tkgrid(OK.but)
tkfocus(tt)
tkwait.window(tt)
invisible(c(loginID=tclvalue(Name), password=tclvalue(Password)))
}
credentials <- getLoginDetails()
The package loads correctly and capabilities("tcltk") comes back as TRUE.
The empty tktoplevel() will load:
But then this error message pops up and R Studio aborts:
Any help would be appreciated! I need this getLoginDetails function for my daily work activities.
If someone has an alternative, I would be open to that, too.
Cheers!
The problem appears to be with TclTk. Rcmdr won't run in R-4.0.1 but runs OK in R-4.0.0
My home-brew package won't load if Tcltk functionality is called.
The release notes for R 4.0.2 report that the bug has been fixed in that version:
Using tcltk widgets no longer crashes R on Windows.

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()

Error in R data.table v1.9.6 - function "fread"

I recently updated to data.table 1.9.6 and get the following error when using fread:
fread("Aug14.csv")
Error in fread("Aug14.csv") :
4 arguments passed to .Internal(nchar) which requires 3
Another post discusses this error in another context, but this worked fine prior to upgrading to data.table 1.9.6. Any advice?
Here's my set up:
sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] data.table_1.9.6 Matrix_1.2-2
loaded via a namespace (and not attached):
[1] modeltools_0.2-21 tools_3.2.0 splines_3.2.0 grid_3.2.0 chron_2.3-47 stats4_3.2.0 lattice_0.20-33
This seems to be a wider problem affecting other packages too and something similar was raised on r-devel here :
http://r.789695.n4.nabble.com/Error-generated-by-Internal-nchar-disappears-when-debugging-td4713138.html
If I understand correctly, CRAN provides one Windows binary for the R 3.2.* series. I guess this binary is built using the latest version of R in that series, currently R 3.2.2. As Andriy T. pointed out in a comment here, the base R function nchar gained an extra argument in R 3.2.1. Since data.table uses the R function nchar and it sets ByteCompile:TRUE in its DESCRIPTION file, the CRAN binary package for Windows doesn't seem to be compatible with R 3.2.0. I guess binary incompatible changes to R itself are supposed to be made to the .0 version only for this reason, but I'm not sure on that. Where packages are compiled on install (e.g. Ubuntu) this isn't an issue.
If you are using R < 3.2.0 on any platform, there shouldn't be a problem.
If you are using R >= 3.2.1 on any platform, there shouldn't be a problem.
If you are using R 3.2.0 on Windows and installing the binary .zip from CRAN (i.e. the default method) then you'll need to either upgrade to R >= 3.2.1, or, build data.table (and potentially any other package using nchar that also set ByteCompile:TRUE) yourself using Rtools.

Resources