
elbe1d - Vignette
Arnd Weber, Christopher Nicholls
2024-09-23
Source:vignettes/elbe1d.Rmd
elbe1d.RmdPurpose
elbe1d is an R package originally developed for research purposes that provides, connects, queries and analyses hydrological, morphological and ecological data along the German federal waterway River Elbe.
Use
Initial setup
To reproduce the code and its functionality a few initial steps need to be taken.
- Start R and install all software dependencies
install.packages(c("devtools", "testthat", "knitr", "knitcitations",
"rmarkdown", "kableExtra", "pkgdown", "DBI", "RSQLite",
"RPostgreSQL", "hyd1d", "hydflood", "leaflet", "purrr",
"sf", "terra", "link2GI", "rgrass", "raster", "Rdpack"))Afterwards close R and return to the console.
- Clone elbe1d
- Set relevant environmental variables in the package directory
echo "hyd1d_datadir=~/.hyd1d" >> elbe1d/.Renviron
echo "hydflood_datadir=~/.hydflood" >> elbe1d/.Renviron- Potentially add credentials for a postgresql database connection
echo '"host";"postgresql.server.org"' >> elbe1d/DB_credentials_elbe1d
echo '"port";"5432"' >> elbe1d/DB_credentials_elbe1d
echo '"dbname";"elbe1d"' >> elbe1d/DB_credentials_elbe1d
echo '"user";"username"' >> elbe1d/DB_credentials_elbe1d
echo '"password";"p@$$w0rd"' >> elbe1d/DB_credentials_elbe1d- Download additional, package-relevant datasets and extract them
directly into
elbe1d/data-raw
wget https://elbe1d.bafg.de/downloads/data-raw.zip -P elbe1d/data-raw/
unzip elbe1d/data-raw/data-raw.zip -d elbe1d/data-raw/- Change into the package directory and automatically download more datasets, check, build and install the package elbe1d. This may take some time.