Unable to install ggplot2 - r

I'm having trouble installing ggplot2 into R. I've looked around here and haven't seen the same error that I'm getting.
> install.packages('ggplot2', dep=TRUE)
Warning in install.packages("ggplot2", dep = TRUE) :
'lib = "C:/Program Files/R/R-2.13.1/library"' is not writable
Error in install.packages("ggplot2", dep = TRUE) :
unable to install packages
Can anybody help?

It would actually suffice to invoke as follows:
> install.packages('ggplot2', dep=TRUE, lib=NULL)
and R should substitue lib with the default location, as in my comment.
Or you could change the environment variable itself.

R needs to have write access to your library to install a package there. The other advice you're getting is good and should be preferred, but you can run R (or RStudio) as an administrator (right-click on the .exe and "Run as Administrator" is an option) which should give it write access to your library.

In RStudio:
Try going to "Tools";
At the top you have "Install packages", click on that;
Then click on "Install to Library", change that to another library and save there.

Related

How to Install mlr3extralearners in R?

So I am going to do some survivalsvm process and I need the mlr3extralearners package from GitHub. When I tried to install it locally using the tar.gz file, it said
Execution halted
Warning in install.packages: installation of package had non-zero exit status
I also tried to use the zip file, and it said
install.packages("C:/Users/Ivan/Downloads/mlr3extralearners-0.5.49.zip", repos = NULL, type = "win.binary", lib="C:/R-4.2.1/library")
then nothing happened.
I also tried using devtools::install_github("mlr-org/mlr3extralearners"), but the output was the same when I used the tar.gz file. When I checked in my library, I already have the mlr3extralearners package, but when I call it using library(mlr3extralearners), it does not work. Does anyone know how to solve this? Any help is appreciated.
https://rdrr.io/github/mlr-org/mlr3extralearners/
I believe this should work for you:
Install the latest version of this package by entering the following in R:
install.packages("remotes")
remotes::install_github("mlr-org/mlr3extralearners")

Trying to install library 'quantmod' in R

I'm trying to download library 'quantmod' in R:
install.packages("quantmod")
console:
The downloaded source packages are in
‘/tmp/RtmpwSKGIl/downloaded_packages’
then:
library("quantmod", lib.loc="/tmp/RtmpwSKGIl/downloaded_packages")
console:
Error in library("quantmod", lib.loc = "/tmp/RtmpwSKGIl/downloaded_packages") :
there is no package called ‘quantmod’
What is the problem?
I get no problem when I try to load this package.Have you tried to provide R the full name path to your package file directory ?C:/Users/...Is your R version up to date ? Try to check if you have the latest, I tried and it worked with :
R 3.3.3
If you are a Windows or MAC user you might want to force the download of the package from source to binary, this can be done by setting the right options in the install.packages command:
options(install.packages.check.source = "no")
https://stat.ethz.ch/R-manual/R-devel/library/utils/html/install.packages.html
I guess I am a year late, but just got out of this situation by installing the Package from R (instead of RStudio) by changing the CRAN.
You can then run library(quantmod) in Rstudio. Hope this works(worked?) for you too.
I am ready to go now!

Installing an R package from local unzipped folder

I am having difficulty installing an unzipped package on a Windows 7 computer without administrative privileges and no internet access. I am using the RGui (not RStudio).
Right now I have an unzipped library sitting in a directory. Unfortunately, when I try:
install.packages("C://path//to//directory",
repos = NULL,
lib = "C://path//to//newDirectory")
I am getting the error:
Warning in `install.packages("C://path//to//directory",` :
'lib = "C://path//to//newDirectory"' is not writable
Which is strange because I do have write privileges to where I am attempting to store the package.
When I get this error, I also get a popup from RGui:
Would you like to use a personal library instead?
If I click Yes, it throws the error:
Error in `install.packages("C://path//to//directory",` :
type == "both" cannot be used with 'repos = NULL'
I also cannot install devtools. Any ideas?
The solution to installing a package that's been unzipped into a folder is as follows:
install.packages("C:/path to folder with the package",
repos = NULL,
type = "source")
I think the error message is actually just wrong. You need to give the file name of the package, not just the directory.
install.packages("C://path//to//directory//MY_PACKAGE.tar.gz",
repos = NULL,
lib = "C://path//to//newDirectory")
If it is an unzipped Windows binary (e.g., from CRAN), you can just copy and paste the entire package directory into your library folder. You could also, presumably, use file.copy() to do so if you wanted to do it within R. install.packages() is failing (weirdly) because you're giving it something other than the typical package source or zipped binary that it is expecting.
I was able to do this using devtools:
devtools::install("path/to/package/folder")
If you have zip file, you can install as follows
install.packages("E:\\R-Packages\\plyr_1.8.4.zip", repos = NULL, type="source")
Go to R-studio
Click the install icon in the packages section found in the right side of the window
A new window pops up
Set "Install from: Package Archive file" "Package Archive: Browse the unzipped file and select it"
Click install
This installs the package to the R library

How to manually install rChart?

I can't install rChart from Rstudio due to some firewall settings in my company computer, so I wonder if I can install it manually. I know it is possible to do that by using install.packages, but it seems the installation was not successful. Here is what I did:
download the master file from https://github.com/ramnathv/rCharts
used the following code to install:
install.packages('\rCharts-master.zip',destdir = "/R/win-library/3.2",repos = NULL)
load the package library(rCharts-master) and resulted in the following error message:
Error in library(rCharts - master) : 'package' must be of length 1
rChart is a package on GitHub, try
install.packages("devtools")
library(devtools)
install_github('ramnathv/rCharts')
library(rCharts)
It should work.
The name of the package you're trying to load is "rCharts", and not "rCharts-master". Try
library(rCharts)

Installing the package ZIGP from R archive

I'm unable to install the ZIGP package in R (version 2.14.1). I've downloaded the file ZIGP_3.8.tar.gz from http://cran.r-project.org/src/contrib/Archive/ZIGP/ to the directory
"C:\Program Files\R\R-2.14.1\library". I've already tried several ways to install this package, but without success! For instance, I entered into the R program as an administrator (item "Run as administrator") and I've tried the command
install.packages("ZIGP", pkgs="C:/Program Files/R/R-2.14.1/library/ZIGP_3.8.tar.gz",repos=NULL), and the error message was:
Warning in install.packages("ZIGP", pkgs = "C:/Program Files/R/R-2.14.1/library/ZIGP_3.8.tar.gz", :
'lib = "ZIGP"' is not writable
Error in install.packages("ZIGP", pkgs = "C:/Program Files/R/R-2.14.1/library/ZIGP_3.8.tar.gz", :
unable to install packages
I've changed the security status in R properties, but the error remains the same.
Do anyone have any idea to solve this problem?
Thanks very much in advance.

Resources