Unable to install dplyr in R 3.3.1 - r

I can't seem to install dplyr or perhaps I really can't install it?
Here's what I have
install.packages("dplyr")
package ‘dplyr’ successfully unpacked and MD5 sums checked
Warning in install.packages :
package ‘C:/Users/808797/AppData/Local/Temp/Rtmpkl7AKB/downloaded_packages’ is not available (for R version 3.3.1)
also tried
>install.packages("https://cran.r-project.org/bin/windows/contrib/3.3/dplyr_0.5.0.zip",repos=null,type=source)
also tried
> library("downloader")
> download("https://cran.r-project.org/bin/windows/contrib/3.3/dplyr_0.5.0.zip","dplyr")
> install.packages("dplyr")
Warning in install.packages :
package ‘dplyr’ is not available (for R version 3.3.1)
always the same is not available (for R version 3.3.1)
am i out of luck?

It is likely your network, or network connection. This is a widely-used package, and I just fired up Virtual Box to demonstrate that, in general, this works as expected.
Things you could try are e.g. downloading something and then checking the md5sum via tools::md5sum().
Otherwise, look at the R-on-Windows FAQ and check e.g. question 2.19 which recommends proxy settings.

the solution is a two step procedure
1] install.packages("assertthat")
2] search google dplyr_0.4.1.tar.gz ..download it from CRAN archives or somewhere ..while in RStudio Tools>InstallPackage(install via archive) ..browse to the .tar.gz ...initiate installation

Probably you are trying to download some package behind a proxy, without a correct configuration. I think that the error message is quite confusing!
For future readers, to solve this problem with RStudio on Linux you should create a file touch ~/.Renviron in your home, edit this file adding you proxy config vim ~/.Renviron (set variables http_proxy= and https_proxy=, each in a different row), then start/restart Rstudio. This should work.
Reference

Related

Problems when installing the broom package

I can not install the broom package. When I try I get this Error Message, that I can't understand:
installing source package 'broom' ...
** package 'broom' successfully unpacked and MD5 sums checked
** using staged installation
Warning in file(file, if (append) "a" else "w") :
cannot open file 'C:/Users/AndrisLagerlvf/Documents/R/win-library/3.6/00LOCK-broom/00new/broom/DESCRIPTION': No such file or directory
Error in file(file, if (append) "a" else "w") :
cannot open the connection
ERROR: installing package DESCRIPTION failed for package 'broom'
removing 'C:/Users/AndrésLagerlöf/Documents/R/win-library/3.6/broom'
Warning in install.packages :
installation of package ‘broom’ had non-zero exit status
I am using a Widows computer with Windows Version 1909 (OS-version 18363.657), and RStudio Version 1.2.5033, and R version 3.6.2.
When I update some packages it works fine, but when I try to update other packages I get similar error messages as above.
Further notes: I used to have the broom package installed, and tried to update the package but when I got the error message I uninstalled the package and then tried to install the package again, but got the same error message, so now I don't have access to the package.
Any suggestions on how to fix would be great! Thanks!
Check out/notice the difference between
C:/Users/AndrisLagerlvf/Documents/R/win-library/3.6
and
'C:/Users/AndrésLagerlöf/Documents/R/win-library/3.6/broom
That is (international) Encoding showing its ugly face.
I would suggest the following as a solution and also a quite common good practice.
Create a (most probably local) directory somewhere you have "good" access to that DOES NOT contain any exotic characters (eg C:\R-PKGS\win-library\3.6) then set this as your standard library path
.libPaths(c("C:/R-PKGS/win-library/3.6", .libPaths())) #watch out for the direction of the slashes (normal ones - not backslashes, since this is R code)
Put the above line into a/your ~/.Rprofile file eg via running file.edit('~/.Rprofile') in the Console.
Let me know if that does not help? I am curious because you mentioned that sometimes it works - my guess is that your routine works for those packages that are installed in R_HOME/library and not for those installed under your User directory, which contains the exotic characters. Additionally you could minggle around with your locale settings until R is satisfied with them, but I have not tested such a solution (yet) ... since this would involve heavy adjustments, to my locale and typeset settings (sorry for that).
Or even better if you want R to branch according to your Version ie if you have multiple subfolders for multiple differing minor R versions (eg R-3.5 and R-3.6 side by side) ie this is how my libPath setting looks like
.libPaths( c( paste0( "D:/R_LIB/", substr(getRversion(),1,3) ), .libPaths() ) )
This has the advantage compared to the ENV VAR approach that you can manage multiple R.version library subfolders ...

R 3.5 package ‘lattice’ was installed by an R version with different internals

I updated R 3.4.4 to R 3.5.0 today. And my package cannot pass R CMD check anymore. It fails at checking whether package can be installed ... ERROR.
In another hand my package works, I can install it and use it as long as I don't check it.
The error is the following:
Error: package or namespace load failed for ‘sp’:
package ‘lattice’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version
Error : package ‘sp’ could not be loaded
I tried to reinstall lattice these ways:
sudo apt-get --reinstall install r-cran-lattice
or
remove.packages("lattice", lib="~/R/x86_64-pc-linux-gnu-library/3.5")
install.package("lattice")
The package lattice is installed correctly in both cases. But it does not solve my problem. Also I ensured to have a single version of lattice removing either the r-cran one or the self compiled version. Nothing works.
Edit By the way I can do library(sp) or library(lattice) it works. But not with R CMD check
The error message tells you that the binary you are attempting to install comes from an insufficient / incompatible R version.
Two fixes:
Install from source as you did. After that check with AP <- available.packages() that you really only have one.
Use the correct binarie: read this README at CRAN and switch to Michael's 'R 3.5' repos. Many of us have been doing that for weeks.
Lastly, the r-sig-debian list is a friendly place for these questions and more. Subscribe first so that you can post.

Problems with installation R packages

I'm a Windows user. A few weeks ago I installed R and Rstudio along with many packages. Today there was a message that new packages were not installed.
Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
I reinstalled R but this did not solve the problem.
Warning in install.packages :
InternetOpenUrl failed: 'Can not connect to server'
This is something that pops up in R and RStudio only once in a while. RStudio changes quite a few settings, and the option "repos" is one of them. On Windows, the following is added
EDIT: It's not RStudio adding this extra repository. The repository is kindly provided by Dr. Brian Ripley for packages that for some reason can't be made available on CRAN (license, not building out of the box, requiring additional software, ...). This is called "CRANextra" in the settings:
> getOption("repos")
CRAN CRANextra
"https://cran.rstudio.com/" "http://www.stats.ox.ac.uk/pub/RWin"
attr(,"RStudio")
[1] TRUE
So RStudio tries to access a specific repository when run on Windows, but that repository has had some connection issues in the past; it isn't always reachable, and when it's not, the warnings you report are issued.
You can get this warning to stop by resetting this option:
options(repos = "https://cran.rstudio.com") # or a repo of your choice.
Which allows you to install packages without the warning:
> install.packages("fortunes")
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/fortunes_1.5-4.zip'
Content type 'application/zip' length 202721 bytes (197 KB)
downloaded 197 KB
package ‘fortunes’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Joris\AppData\Local\Temp\Rtmpu0febg\downloaded_packages
Even when this warning is displayed, packages still get installed from the rstudio CRAN mirror. The warning is reported as a bug, and RStudio has promised to tackle it soon.
EDIT: More information on the CRANextra repository in R FAQ (last paragraph):
Some CRAN packages that do not build out of the box on Windows,
require additional software, or are shipping third party libraries for
Windows cannot be made available on CRAN in form of a Windows binary
packages. Nevertheless, some of these packages are available at the
“CRAN extras” repository at https://www.stats.ox.ac.uk/pub/RWin/
kindly provided by Brian D. Ripley. Note that this repository is a
default repository for recent versions of R for Windows.
In the mean while R Studio fixes the bug, a temporal solution for not having to especifie the CRAN repository every time we start an R session, is to edit your "Rprofile.site" file and add this line
options(repos = getOption("repos")["CRAN"])
That way every time an R session is started the CRANextra repository ("http://www.stats.ox.ac.uk/pub/RWin") is removed automatically. Just remember to delete or comment with # this line after the bug is solved.
I was facing similar issue and the fix that worked for me is that, in RStudio I've opened tools -> Global Options -> Packages -> Primary CRAN Repository -> Set Global.
Also make sure you're not using installed.packages this happens to a lot of people because of RStudio typing suggestions.
You need to use install.packages("<package_name>")

Error in R: (Package which is only available in source form, and may need compilation of C/C++/Fortran)

I'm trying to install the 'yaml' and 'stringi' packages in R-Studio, and it keeps giving me these errors:
> install.packages("stringi")
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘stringi’
These will not be installed
or
> install.packages('yaml')
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘yaml’
These will not be installed
How can I get these to install properly?
The error is due to R being unable to find a binary version of the package on CRAN, instead only finding a source version of the package and your Windows installation being unable to compile it. Usually this doesn't occur, but in this case was caused by the (temporary) outage of some of the mirrors at CRAN. If you type:
> getOption('repos')
CRAN CRANextra
"http://cran.rstudio.com" "http://www.stats.ox.ac.uk/pub/RWin"
attr(,"RStudio")
[1] TRUE
You will see that R uses "http://cran.rstudio.com" by default to look for a package to download. If you see the cran mirrors web page you can see at the top that "http://cran.rstudio.com" actually redirects you to different servers world wide (I assume according to the geo location).
When I had the above issue, I solved it by manually changing the repo to one of the urls in the link provided. I suggest you use a different country (or even continent) in case you receive the above error.
I provide below some of the urls in case the link above changes:
Brazil http://nbcgib.uesc.br/mirrors/cran/
Italy http://cran.mirror.garr.it/mirrors/CRAN/
Japan http://cran.ism.ac.jp/
South Africa http://r.adu.org.za/
USA https://cran.cnr.Berkeley.edu/
You need to run the function install.packages as follows:
install.packages('<package_name>', repo='http://nbcgib.uesc.br/mirrors/cran/')
#or any other url from the list or link
One of them should then work to install a binary from an alternative mirror.
You need to install RTools to build packages like this (i.e., a source package rather than a binary). After you install Rtools, then try again to install.packages("ggplot2") and R will prompt you with:
Do you want to attempt to install these from source?
y/n:
(see the picture below)
You need to answer y and it will try to compile the package so it can be installed.
Struggled with this issue today, solved it for now by first downloading the windows binary and then installing e.g.
install.packages("https://cran.r-project.org/bin/windows/contrib/3.3/stringi_1.1.1.zip", repos =NULL)
Just go to https://cran.r-project.org/ and then R Binaries/Windows/contrib and copy the url as argument to install.packages()
Install the package from a zip file - downloadable from the r-project website.
In basic R
go to Packages
Install packages from local files.
In RStudio
go to Packages
Install packages
Install from Package Archive File.
I had this issue when using an out-of-date version of R, so no binaries were available. The simple solution was to update my version of R.
Anything worked for me, until I found out my computer had an old version of R installed. Uninstalling everything and installing the newest R version worked!
I had to download the latest version of Rtools:
Go into the downloads folder and double click it to install it.
Close and reopen any R session.
Now packages should install like normal.
However, if you still have trouble, try installing the package from source (using type="source")
Like this:
install.packages("dplyr", type="source")

Error while installing R package: package built for universal-apple-darwin

I installed a R package as suggested by How do I install an R package from source?, using R CMD INSTALL [my_pkg_path.tgz]. Package sources are downloaded from r-project.org, e.g., http://cran.r-project.org/web/packages/fields/index.html
However, when I try to load the package using say library(fields), I got the error that complains the package are built for universal-apple-darwin:
Error: package ‘fields’ was built for universal-apple-darwin9.8.0
Guess it's something to do with architecture, but no idea how to resolve it. Any idea? Thanks.
It looks like you downloaded the package's Mac OSX binary file, which usually ends in .tgz - try downloading the package source (usually something ending in .tar.gz) and installing the package again.
Depending on what your operating system is, you may need an additional set of software before you can install packages from source. If the above suggestion doesn't work, would you provide some information about the OS, for example from sessionInfo()?

Resources