R studio install package failed - r

I tried to install the packages in the following way:
pacman::p_load(tidyverse, lubridate, zoo,
timetk, modeltime,
trelliscopejs, seasonal,
tsibble, feasts, fable)
However, I got the below errors:
I'm not sure what's wrong, I'm using the latest R version 4.2.1, the warning seems to suggest that need to change to 4.1.3, is there anyway to install those packages without changing the version?

The problem is not related to the package in itself. The warning about the version only tells you that the last time this package was built was on R 4.1.3, but it should work on R 4.2.
The problem is that the place where R searches this package doesn't exist. If you go here: https://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/, you will see that the last version of R is 3.4, whereas you're looking for a package built in R 4.1 (see the version in the URL address in the error message).
Here's some advice to solve this (I can't reproduce your problem so I can't be sure this works): if you're using RStudio, go to "Tools -> Global Options -> Packages". I think that under "Primary CRAN repository", there should be the name of the current place where R searches for the files to install each package. You can change this: either pick "Global (CDN) - RStudio" or any other that is not too far from your location. Then restart R and try reinstalling the packages.

Related

Difficulty installing a package in R linux, dalton_rqi

Downloaded package from below URL.
Attempted to install using below command; response shown.
library(dalton.rqi,lib.loc='/home/X/Desktop/')
Error: package ‘dalton.rqi’ was built before R 3.0.0: please re-install it
https://my.clevelandclinic.org/departments/anesthesiology/depts/outcomes-research/risk-quantification
It appears this is a compiled package that maybe I don't have the source for? Is there a way to force install of the package? I'm unable to install using Rstudio GUI in its current form as a zip. Tried repackaging to tar.gz has Rstudio was looking for and also had a non-zero exit status error.
Any ideas?
I'm afraid this can't be achieved directly. The error message says it well: to use a package in R it needs to be built on an R version matching yours.
I can suggest two ways to move forward:
Contact the authors, ask for the R sources (it is somewhat surprising they did not make them available in the first place), and build the package yourself.
Downgrade your R version as far back as needed to match the one this pre-built package used.

Error: package or namespace load failed for 'ggplot2': package 'ggplot2' was installed before R 4.0.0: please re-install it Execution halted

I'm really stuck and need some help.
After installing R 4.0.2, I'm getting this error message on R visualizations in Power BI Desktop which were previously working
"Error: package or namespace load failed for 'ggplot2':
package 'ggplot2' was installed before R 4.0.0: please re-install it.
Execution halted"
I already tried to:
reinstall R 4.0.2
reinstall RStudio
reinstall ggplot2
reinstall all packages
reinstall Power BI Desktop. My version is August-2020
Still it does not work.
Considerations:
My visualizations were working well before I installed R 4.0.2
My visualizations are working well on other PCs
When I run the code on RStudio I don't get any error
Any thoughts?
You probably need to go here: https://powerbi.microsoft.com/en-us/support/, but some guesses:
When you did the reinstall, you didn't clean up the old one, so you now have a mix of old and new versions of things. If you can run R code, run
system.file(package="ggplot2")
That's where it is finding the bad version of ggplot2. Get rid of it, and reinstall. If that's not enough, run
.libPaths()
in the broken copy of R. Completely eradicate every directory mentioned there, and reinstall R and all of your contributed packages. (I don't use Power BI, so this might also require you to wipe out some part of it: do so, and reinstall it.)
After all of this, run
packageDescription("ggplot2")
In the last line (or close to it) of what gets printed, you should see something like this:
Built: R 4.0.2; ; 2020-07-16 22:49:23 UTC; unix
If you see that it was built before 4.0.2, then either you missed deleting something, or you (or Microsoft) reinstalled some old version. Then it's probably time to contact that URL above.

How to install Package MVTNORM

I am trying to install package mvtnorm, but it says that package ‘mvtnorm’ is not available (for R version 3.4.4)....
I believe this is happening cause of R version..... but When I am trying to upgrade R...it is not allowing me to do so.
I tried to install package "installr" for upgrading R, but it showed the same error - "installr’ is not available (for R version 3.4.4).
There is update tab under "HELP" on the console panel of the studio...it is not responding....
I am using Linux machine for the first time...so i am really confused on how to go about.
I hope to get this thing solved with some help from an expert who can guide me on how to proceed.

In continuation to previously asked "Unable to work with R-extension in NetLogo"

After changing all the needed environment varaibles ( Control Panel/ System/Advanced system settings/Environment Variables) in windows 8, when I am installing rJava Package I get errors as below
I tried in MsDOS immediately after changing environment variables,
first step >R "it was successful"
second >install.packages("rJava") "got error in this step"
then I tried >install.packages("rJava", repos="https://cran.rstudio.com/") "but again I did not succeeded"
I am tired of trying all this, I referred many links already but all in vain. Yes, I am using Proxy also. Please help any one.
1) It seems a download problem first. So do this:
Download rJava_0.9-8.zip from CRAN (cran.r-project.org/web/packages/rJava/index.html). Then, in Revolution R Enterprise; Packages - "Install Packages From local Zip Files..." - Choose rJava_0.9-8.zip - OK. If the problem is solved then OK.
If the problem persists, try the following Step.
2) Look at DESCRIPTION file in rJava (in library location):
Package: rJava
Version: 0.9-8
....
Depends: R (>= 2.5.0), methods
....
NeedsCompilation: yes
Your R version may be incompatible. Look at the warning: "rJava is not available for R3.3.0" in your screenshot. So do this:
Unzip file rJava_0.9-8.zip to R's working directory; the folder rJava is created there. Change R version accordingly (you may introduce lower version number in Depends section). Save the changed DESCRIPTION file. Apply classical procedure:
library(roxygen2) # install this package first if not done yet
library(devtools) # install this package first if not done yet
library(digest) # install this package first if not done yet
Note: Since rJava folder is created manually, no package.skeleton is needed at this stage.
roxygenize("rJava")
build("rJava")
install("rJava")
The above technique must solve the problem (It solved previously many R version problems!).
Analyze this one also:
Install a specific release of bioconductor package (where the solution I wrote solved the problem of the questioner).
If you still have problems, trigger the following:
sessionInfo(); getwd(); .libPaths()
and print the output in your question so that we can analyze if you have any machine-spesific or installation-spesific problems.

Package unavailable in package build after R update using packrat

I recently updated to R 3.1.3 and I am building a package using RStudio and packrat. I am trying to re-build my package using RStudio's in built "Build and Reload" tool, but it won't work. I keep receiving the following error:
Updating standaRd documentation
Loading standaRd
Error in (function (dep_name, dep_ver = NA, dep_compare = NA) :
Dependency package ggplot2 not available.
Calls: suppressPackageStartupMessages ... <Anonymous> -> load_all -> load_depends -> mapply -> <Anonymous>
Execution halted
Exited with status 1.
The thing is, I have ggplot2 installed in all places including my local libraries and my packrat libraries for this project for both R 3.1.2 and R 3.1.3. I have tried loading them in to no avail.
Also, using devtools::build() and devtools::document() both work, so I am assuming that this is an RStudio issue?
I am using RStudio Version 0.99.235. I also cannot see any of my documentation for my package and it doesn't appear to be in my packrat library.
I have since uninstalled R 3.1.3 and reverted back to R 3.1.2 and I am still getting the same issue.
These are my dependencies:
Depends:
R (>= 3.1.2),
ggplot2 (>= 1.0.0),
grid
packrat doesn't seem to be great at handling this, and I always fail to find the documentation I'm looking for. I managed to get it to install packages for the new version, but I don't know exactly which steps were crucial and in which order.
packrat.lock contained a reference to the old RVersion. This can be updated by hand, but packrat::snapshot() also did it for me. I tried packrat::restore() after this and didn't see a new directory for the R version in PROJECT/packrat/lib/ARCH/. I tried restarting and reloading RStudio, the project and packrat a few times and eventually got it to install packages in there. One more project reload and the packages could be seen.
I think there is a "blessed" command sequence for this and it was easier for me in the past.
It may worth to use the renv package instead of packrat.
From https://rstudio.github.io/renv/articles/renv.html
The goal is for renv to be a robust, stable replacement for the
Packrat package, with fewer surprises and better default behaviors.

Resources