Skip to content

Commit

Permalink
course page used where applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
brry committed Aug 1, 2017
1 parent 780e794 commit 3ebd3f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 71 deletions.
54 changes: 2 additions & 52 deletions README.md
Expand Up @@ -3,9 +3,6 @@
/ [slides](#slides)
/ [check](#check)
/ [resources](#resources)
/ [install](#install)
/ [packages](#packages)
/ [r-intro](#r-intro)

### course
Using R in Hydrology - [EGU2017 Short Course](http://meetingorganizer.copernicus.org/EGU2017/session/25731) by YHS
Expand Down Expand Up @@ -54,11 +51,6 @@ This will give instructions if packages are missing / outdated.
* [hdtools](https://ropensci.github.io/hddtools/) - R package to facilitate access to a variety of online open data sources relevant for hydrologists
* [rdwd](https://github.com/brry/rdwd#rdwd) - R package specifically for German meteorological data
* [airGR](https://cran.r-project.org/web/packages/airGR/vignettes/airGR.html) - The description of the airGR package
* [R-weekly](https://rweekly.org/) - weekly newsletter about all things R
* [Rbloggers](https://www.r-bloggers.com/) - blog aggregator about R
* [Shiny](https://shiny.rstudio.com/) - web application framework for R/Rstudio
* [Rmarkdown](http://rmarkdown.rstudio.com/) - document/notebook generation framework for R/Rstudio
* [Github guides](https://guides.github.com/) - Introduction to github
* [Hydrology in R Facebook group](https://www.facebook.com/groups/1130214777123909/)
* [RegressionInfluence](https://davidpwright.shinyapps.io/LinearRegressionInfluenceExample/) - Shiny App by David Wright
* [Evapotranspiration](https://cran.r-project.org/package=Evapotranspiration) - R package that enables the use of 17 well-known ET models in a consistent manner.
Expand All @@ -67,49 +59,7 @@ This will give instructions if packages are missing / outdated.
[part 3 (Geodesy & Local Map Projections)](https://medium.com/@robsimmon/a-gentle-introduction-to-gdal-part-3-geodesy-local-map-projections-794c6ff675ca) and
[part 4 (Working with Satellite Data)](https://medium.com/@robsimmon/a-gentle-introduction-to-gdal-part-4-working-with-satellite-data-d3835b5e2971),

More resources and R installation instructions at

### install
install R and Rstudio:

* R: https://cloud.r-project.org (Linux Ubuntu instructions below)
* Rstudio: https://www.rstudio.com/products/rstudio/download/#Desk
* updating R on Windows is simple: https://github.com/talgalili/installr/blob/master/README.md
* R installation on Ubuntu (from [Kris Eberwein](https://www.r-bloggers.com/how-to-install-r-on-linux-ubuntu-16-04-xenial-xerus) and [Dean Attali](https://www.digitalocean.com/community/tutorials/how-to-set-up-r-on-ubuntu-14-04)): open a terminal (CTRL+ALT+T) and paste (CTRL+SHIFT+V) the following lines:

```
sudo echo "deb http://cran.rstudio.com/bin/linux/ubuntu xenial/" | sudo tee -a /etc/apt/sources.list
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -
sudo apt-get update
sudo apt-get install r-base r-base-dev
```
Replace `xenial` with e.g. `trusty` if you have another Ubuntu version:
16.10 yakkety, 16.04 xenial, 14.04 trusty, 12.04 precise

### packages

Installing add-on R packages usually is easy from within R (and works without admin rights):
```R
install.packages("ggplot2")
```
On Linux, some packages with external dependencies (like rJava) can be more difficult.
In such cases, you probably just want to open a terminal (CTRL+ALT+T) and paste (CTRL+SHIFT+V) `sudo apt-get install r-cran-rjava` (all lower-cased).
Here's the [official information](https://cran.r-project.org/bin/linux/ubuntu/README.html#supported-packages) on this topic.

Installing the brand new `sf` package for spatial data is a bit tricky on Linux because it needs a recent version of gdal.
If `install.packages("sf")` does not work, please try the following:
```
sudo apt-get install libudunits2-dev
sudo add-apt-repository ppa:ubuntugis/ppa && sudo apt-get update
sudo apt-get install gdal-bin
sudo apt install libgdal-dev libproj-dev
```

### r-intro
If you need an introduction (or a refresher) to R, we suggest:

* http://stat545.com/topics.html (excellent tutorial)
* https://www.edx.org/course/introduction-r-programming-microsoft-dat204x-0 (Datacamp, with login, but free)
* http://tryr.codeschool.com/levels/1/challenges/1 (codeschool, interactive, login to save progress)
* https://github.com/brry/course/raw/master/RcourseBerry.pdf (Berry's R course material)
* [github.com/brry/course](https://github.com/brry/course#install)

22 changes: 3 additions & 19 deletions checkpc.R
Expand Up @@ -3,14 +3,12 @@

checkpcfun <- function(...) # to keep everything within a function environment
{
link <- " visit \nbrowseURL('https://github.com/brry/rhydro#install')\n"
link <- " visit \nbrowseURL('https://github.com/brry/course#install')\n"
errors <- FALSE # are there significant insufficiencies?

isinstalled <- function(p) # is a package installed and usable?
{
out <- requireNamespace(p, quietly=TRUE)
try(unloadNamespace(p), silent=TRUE)
out
suppressMessages(suppressWarnings(requireNamespace(p, quietly = TRUE)))
}

# R ----
Expand Down Expand Up @@ -64,20 +62,6 @@ packs2get <- packs[!inst]


# Package versions ----
mapv <- "mapview" %in% packs2get
if(!mapv) if(packageVersion("mapview") < "1.2.68") mapv <- TRUE
if(mapv)
{
errors <- TRUE
if("mapview" %in% packs2get)
message("The installed version of package 'mapview' is too old. Please run:")
else
message("The package 'mapview' must be installed from github. Please run:")
cat(if(!isinstalled("devtools")) "install.packages('devtools'); ",
"devtools::install_github('environmentalinformatics-marburg/mapview', ref='develop')\n", sep="")
}
packs2get <- packs2get[packs2get!="mapview"]

cranpacks <- available.packages()
packs <- packs[inst]
outdated <- sapply(packs, function(p) packageVersion(p) < cranpacks[p,]["Version"])
Expand All @@ -94,7 +78,7 @@ if(osm) message("If OSMscale installation fails, read the instructions at ",
"\nhttps://github.com/brry/OSMscale#installation")
if(sf & Sys.info()["sysname"]=="Linux")
message("If sf installation fails, read the instructions at ",
"\nhttps://github.com/brry/rhydro#packages")
"\nhttps://github.com/brry/course#packages")
if(errors){message("Afterwards, rerun:")
cat("source('https://raw.githubusercontent.com/brry/rhydro/master/checkpc.R')\n")
message("Please report if something in these instructions is not working via berry-b@gmx.de")}
Expand Down

0 comments on commit 3ebd3f9

Please sign in to comment.