Skip to content

0. How to install?

abdelkaderm edited this page Sep 21, 2015 · 19 revisions

IMPORTANT NOTICE ** ** The ncdf4 dependency has been removed and replaced by ncdf as Windows users have encountered problems when installing the esd package. You may need to install ncdf and please visit https://github.com/metno/esd/issues/70 for more details

From R-cran repository

esd cannot be installed directly from the R-cran repository, alternatively, there are several options listed below

From GitHub using R (copy the lines below into your R-window - this may take several minutes depending on the connection)

## Check if you need to get the devtools-package:
install.devtools <- ("devtools" %in% rownames(installed.packages()) == FALSE)

if (install.devtools) {
  print('Need to install the devtools package')
  ## You need online access.
    install.packages('devtools')
}

## Use the devtools-package for simple facilitation of installing.
library('devtools')
install_github('metno/esd')

A progress message is shown on the screen and a confirmation "DONE" is displayed when the installation is completed. Also, the library is loaded. This may take few minutes depending on the connection.

Screenshot

Downloading github repo metno/esd@master
Installing esd
'/usr/lib/R/bin/R' --vanilla CMD INSTALL  \
  '/tmp/RtmpjGyD1n/devtools239c70931bd9/metno-esd-ea15e85'  \
  --library='/home/user.name/R_libs' --install-tests 
* installing *source* package ‘esd’ ...
** R
** data
** demo
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (esd)
Reloading installed esd

From a Shell/Terminal

First, users need to install the related libraries to the package as

 > install.packages('ncdf4')
 > install.packages('zoo')

Note that some of the operating systems may need additional library for the 'ncdf4' package to be installed correctly. For instance, UBUNTU users need to install first the development kit for NetCDF (libnetcdf-dev).

Then, download the package from the github main page https://github.com/metno/esd using the 'Download ZIP' bottom on the right hand side of the page. Unzip the file, then install the package from the Linux/Mac shell as

$ R CMD INSTALL esd-master

From figshare,
First, download the 'esd' zipped file which corresponds to your operating system (Linux, Mac, or Windows) following this link esd-on-figshare. Then, download the zipped file from the esd repository on your local machine, and type the following command lines to begin the installation

on a linux shell

$ R CMD INSTALL esd.tar.zip

on R shell

> install.packages("esd.tar.gz")

A progress message is shown on the screen and a confirmation "DONE" is be displayed when the installation is completed.

Screenshot

* installing to library ‘/home/abdelkaderm/R_libs’
* installing *source* package ‘esd’ ...
** R
** data
** demo
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (esd)

Open an R session,

$ R

screenshot

R version 3.0.3 (2014-03-06) -- "Warm Puppy"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
  Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
[Previously saved workspace restored]
´´´

Load the library into R  

`> library(esd)`

> screenshot
```rout
Loading required package: ncdf4
Loading required package: zoo
Attaching package: ‘zoo’
The following objects are masked from ‘package:base’:
    as.Date, as.Date.numeric

Check the package version by typing

> packageVersion("esd")

screenshot

[1] ‘0.5.1’

Add the esd package into the default list of packages using

options(defaultPackages=c(getOption("defaultPackages"),"esd"))