[R-sig-Geo] How to install R packages

Roman Luštrik roman.lustrik at gmail.com
Thu Mar 9 16:04:41 CET 2017


If the package is on CRAN, you should just do

install.packages("pastecs")

and R will install the package. You can then use it by calling it with

library(pastecs)

This is the preferred way of installing packages for novice users. If this
is insufficient for you, read on.




To compile from source, you will need a bit more tools. It would appear you
are on Windows. You need to install Rtools to be able to compile and
install R packages.

First try installing package devtools

install.packages("devtools")

During the installation, the interface should ask you if you want to
install RTools. Say yes.

Once finished and assuming everything went well, you should be able to
install from local, github... whatever

install_local("c:/users...path/to/file.tar.gz")

or

install_github("cran/pastacs")

Cheers,
Roman

On Thu, Mar 9, 2017 at 3:12 PM, <philipova at imbm.bas.bg> wrote:

> Dear R-users,
> Please tell me how to install R packages. I have downloaded source files
> of some packages (*.tar files). I put them in a directory in my computer.
> The computer asked me whether to make personal library.
> I tried with:
> install.packages(pkgs='pastecs', lib='C;/User/doktorant-220/My
> Documents/R/win-library/3.3/pastecs_1.3-18.tar',repos=NULL,type="source")
>
> R gives me the following message:
> Warning in install.packages(pkgs = "pastecs", lib =
> "C:/User/doktorant-220/My Documents/R/win-library/3.3/pastecs_1.3-18.tar",
>  :
>   'lib = "C:/User/doktorant-220/My
> Documents/R/win-library/3.3/pastecs_1.3-18.tar"' is not writable
> Warning: invalid package 'pastecs'
> Error: ERROR: no packages specified
> Warning messages:
> 1: running command '"C:/PROGRA~1/R/R-33~1.3/bin/i386/R" CMD INSTALL -l
> "C:\Users\doktorant-220\Documents\R\win-library\3.3" "pastecs"' had status
> 1
> 2: In install.packages(pkgs = "pastecs", lib = "C:/User/doktorant-220/My
> Documents/R/win-library/3.3/pastecs_1.3-18.tar",  :
>   installation of package ‘pastecs’ had non-zero exit statu
>
> I will be grateful for your help!
> Nina
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo




-- 
In God we trust, all others bring data.

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list