Trouble installing DevTools in RStudio - r

I'm trying to install DevTools using RStudio with my R version 4.0.5.
I install the packages in RStudio from the CRAN repository, and everything looks fine until the following comes up:
obviously processx is a dependency of DevTools. The trouble seems to start when the system tries to use the 'as' executable in RTools. It can't seem to use it but it's definitely there and in the same folder as my gcc executable:
I've already added the following values to the following environment variables:
Variable
Value
Path
C:\Program Files\R\R-4.0.5\bin;C:\rtools42\usr\bin;
BINPREF
C:\rtools42\x86_64-w64-mingw32.static.posix\bin\
R_HOME
C:\Program Files\R\R-4.0.5\library\base\R\Rprofile
R_LIBS_USER
C:\Program Files\RPackages
R_USER
C:\Program Files\R\R-4.0.5
RTOOLS42_HOME
C:\rtools42
I'm wondering what to try next?
EDIT: See below for results of GCC -v as suggested:
Edit 2: The original issue was fixed by updating my R version, but now as I try to install a package called "markdown" I'm encountering this next issue:
Edit 3: here is the output from my sessioninfo():
sessionInfo(package = NULL)
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C LC_TIME=English_United States.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] sessioninfo_1.2.2
loaded via a namespace (and not attached):
[1] compiler_4.2.1 cli_3.4.1 tools_4.2.1
Here's the output from Help > About RStudio:
RStudio
2022.07.2 Build 576
© 2009-2022 RStudio, PBC
"Spotted Wakerobin" Release (e7373ef8, 2022-09-06) for Windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36

I believe you use the wrong R and RTools combination:
Use Rtools 4.0 for any R Version below R 4.2.0 as the following page suggests:
https://cran.r-project.org/bin/windows/Rtools/

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

Package 'xxx’ was installed before R 4.0.0: please re-install it (already done fresh install and checked lib paths)

I am having some issue with installing a package in R 4.0.2 from binaries. Here is my attempt:
> install.packages("C:/Users/MNestor/Downloads/libSBML_5.18.0.zip", repos = NULL, type = "win.binary")
Installing package into ‘C:/Users/MNestor/Documents/R/win-library/4.0’ (as ‘lib’ is unspecified)
package ‘libSBML’ successfully unpacked and MD5 sums checked
Warning messages:
1: multiple methods tables found for ‘type’
2: multiple methods tables found for ‘type<-’
Next I load library:
> library('libSBML')
Error: package or namespace load failed for ‘libSBML’:
package ‘libSBML’ was installed before R 4.0.0: please re-install it
This error is confusing to me because I am working in R 4.0.2 and have clearly just done a fresh install.
I have tried
deleting the library folder and reinstalling
running remove.packages('libSBML') and reinstalling
For reference here are my library directories:
> .libPaths()
[1] "C:/Users/MNestor/Documents/R/win-library/4.0"
[2] "C:/Program Files/R/R-4.0.2/library"
The libSMBL folder is located in the first library path, and not the second (as expected).
Here is session info:
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] rsbml_2.46.0 BiocGenerics_0.34.0
loaded via a namespace (and not attached):
[1] BiocManager_1.30.10 compiler_4.0.2 tools_4.0.2 remotes_2.2.0
[5] stats4_4.0.2 SBMLR_1.84.0 graph_1.66.0
The error message is maybe a bit confusing, but it's saying the package is already compiled for an earlier version of R. (That's what the option "win.binary" means).
R 4.0 and earlier binaries are not compatible because of updated compilers and build tools.
You'll need to install the package from source, which likely means installing R tools (https://cran.r-project.org/bin/windows/Rtools/) or you'll need to use a version that is pre-built for R 4.0 or later.

Problems doing citations using RStudio with natbib with a bibliography style

Consider the following:
test.rnw
\documentclass[12pt]{article}
\usepackage{natbib}
\usepackage[margin=1in]{geometry}
\begin{document}
<<setup, include = FALSE, echo = FALSE>>=
Sys.setenv(TEXINPUTS = getwd(),
BIBINPUTS = getwd(),
BSTINPUTS = getwd())
#
Some text \citet{brockwelldavis}
\newpage
\nocite{*}
\bibliographystyle{jasa}
\bibliography{test}
\end{document}
test.bib
#book{brockwelldavis,
author = {Brockwell, Peter J. and Davis, Richard A.},
year = 2016,
title = "Introduction to Time Series and Forecasting",
editor = "",
publisher = "Springer International Publishing",
address = "Switzerland"
}
jasa.bst
This file can be found at either https://github.com/merliseclyde/AAIS/blob/master/jasa.bst or https://github.com/auk12/MSc-Thesis-backup/blob/master/Bibliography/jasa.bst.
Problem Description
In RStudio, when I hit "Compile PDF" using test.rnw, I get
output file: test.tex
[1] "test.tex"
Running pdflatex.exe on test.tex...failed
Issues: 2 warnings
and from the log file:
Package natbib Warning: Citation `brockwelldavis' on page 1 undefined on input
line 58.
[1
{C:/Users/[my name]/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}]
No file test.bbl.
Package natbib Warning: There were undefined citations.
So, I run test.tex created from test.rnw using pdfLaTeX + MakeIndex + BibTeX in TeXworks, and test.bbl is created. Interestingly, test.pdf compiles correctly and can be viewed through TeXworks. I can clearly both the .bbl and .pdf files using Windows Explorer.
But when I hit "Compile PDF" in RStudio after compiling through TeXworks, I still get the same warning as above. Anyone have any insight as to how to fix this?
Additional Note
What's also baffling is that on my old computer, test.rnw compiles fine without having to use TeXworks as an intermediate step and on my new computer, it does not. The only difference I can think of is that perhaps my new computer has more updated versions of R and MikTeX. I also tried uninstalling and reinstalling MikTeX on my new computer and still ran into the same problem.
New Computer setup:
From R (using RStudio 1.2.5033):
> sessionInfo()
R version 3.6.3 (2020-02-29)
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
[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_3.6.3 tools_3.6.3
Through the Windows command prompt:
> pdftex --version
MiKTeX-pdfTeX 2.9.7338 (1.40.21) (MiKTeX 2.9.7380 64-bit)
Copyright (C) 1982 D. E. Knuth, (C) 1996-2020 Han The Thanh
TeX is a trademark of the American Mathematical Society.
using bzip2 version 1.0.6, 6-Sept-2010
compiled with curl version 7.61.1; using libcurl/7.61.1 WinSSL
compiled with expat version 2.2.6; using expat_2.2.6
compiled with jpeg version 9.3
compiled with liblzma version 50020042; using 50020042
compiled with libpng version 1.6.37; using 1.6.37
compiled with libressl version LibreSSL 2.8.2; using LibreSSL 2.8.2
compiled with MiKTeX Application Framework version 4.7348; using 4.7348
compiled with MiKTeX Core version 16.7375; using 16.7375
compiled with MiKTeX Archive Extractor version 1.6882; using 1.6882
compiled with MiKTeX Package Manager version 9.7364; using 9.7364
compiled with poppler version 0.60.1
compiled with uriparser version 0.9.2
compiled with zlib version 1.2.11; using 1.2.11
Old Computer setup:
From R (using RStudio 1.2.5001):
> sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] 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_3.6.2 tools_3.6.2
Through the Windows command prompt:
> pdftex --version
MiKTeX-pdfTeX 2.9.6050 (1.40.17) (MiKTeX 2.9 64-bit)
Copyright (C) 1982 D. E. Knuth, (C) 1996-2016 Han The Thanh
TeX is a trademark of the American Mathematical Society.
compiled with zlib version 1.2.8; using 1.2.8
compiled with libpng version 1.6.24; using 1.6.24
compiled with poppler version 0.46.0
compiled with jpeg version 8.4
Both are using knitr and pdfLaTeX based on Tools > Global Options > Sweave in RStudio.
This has finally be resolved in the RStudio IDE, and the fix will appear in the patch release after RStudio 1.4, which is not available yet. Currently you have to use the daily build of RStudio: https://dailies.rstudio.com
In Tools -> Global Options, you can check the box "Use tinytex when compiling .tex files":
Then the bibliography should be compiled correctly.
I had a similar problem, on Windows. I tried to use R-studio and Miktex, but bibliographic citations were not generated. I installed TinyTex but it was in conflict with Texmaker. Solution: I installed the full Texlive. Everything working now.
RStudio (1.3.959), R (4.0.2), Texlive (2020-r55535), Texmaker 5.0.4, Windows 10 x64 single language.

Unable to install Github packages in R

I need a packages witch is located on Github. And I am aware that there are multiple solutions to install the package in R.
I am trying to install the package on a Windows server. This is what I tried:
Solution 1 (which is based on the Vignette)
install.packages("devtools")
library("devtools")
devtools::install_github("bmschmidt/wordVectors")
Error: Could not find tools necessary to compile a package
In addition: Warning messages:
1: In strptime(xx, f, tz = tz): unable to identify current timezone 'C':
Please set environment variable 'TZ'
I tried many things to solve this:
Reinstalling Devtools, use the CRAN devtools version
Reinstalling R and Rstudio (installing the latest versions as admin) (Error : Could not find build tools necessary to build)
But still the same error...
So I tried a workaround to install the packages on my computer:
Solution two
Download ZIP file from (https://github.com/bmschmidt/wordVectors)
Unzip the ZIP file
But the result is an error again:
library(devtools)
install("path/to/unzipped/file")
library("wordVectors")
Error there is no packages called wordVectors.
Anyone an idea what is going on? I struggled the whole day with this issue. Help is really appreciated! Thanks!
Edit
Also Rtools is (re)installed (the latest version...)
Edit 2
As requested in the comments (#DJV):
> sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server >= 2012 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets
[6] methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.2 tools_3.5.2

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

Resources