Package 'esmisc'

Title: Misc Functions of Eduard Szöcs
Description: Misc functions programmed by Eduard Szöcs. Provides read_regnie() to read gridded precipitation data from German Weather Service (DWD, see <http://www.dwd.de/> for more information).
Authors: Eduard Szöcs [aut, cre]
Maintainer: Eduard Szöcs <[email protected]>
License: MIT + file LICENSE
Version: 0.0.3.9002
Built: 2024-11-20 04:05:15 UTC
Source: https://github.com/eduardszoecs/esmisc

Help Index


Geometric mean

Description

Function for the geometric mean.

Usage

geomean(x, na.rm = TRUE)

Arguments

x

a numeric vector.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

Details

The geometric mean is comuted as

x=e(logx)/nx = e^{(\sum \log x) / n}

Value

numeric vector of length one with the geometric mean.

References

http://stackoverflow.com/questions/2602583/geometric-mean-is-there-a-built-in

Examples

x <- c(1, 10, 100)
mean(x)
geomean(x)

Extract numbers from string

Description

Extract numbers from string

Usage

numextractall(x)

Arguments

x

string

Value

numeric vector

References

http://stackoverflow.com/questions/19252663/extracting-decimal-numbers-from-a-string

Examples

numextractall('1 2 3')
numextractall('1,2,3')
numextractall('1;2,3 4')
numextractall('1;2,3 4,46')

Read DWD REGNIE gridded data into R

Description

This functions reads DWD REGNIE data. A description of the data can be found here (pdf-format): https://www.dwd.de/DE/leistungen/regnie/download/regnie_beschreibung_pdf.pdf?__blob=publicationFile&v=2. Data is available here: ftp://ftp-cdc.dwd.de/pub/CDC/grids_germany/daily/regnie/.

Usage

read_regnie(file)

Arguments

file

path to gz archive

Value

A RasterLayer object.

Examples

# Read daily precipitation on 20.01.2005.
r <- read_regnie(system.file("extdata", "ra050120.gz", package = "esmisc"))

Custom ggplot2 theme

Description

Custom ggplot2 theme

Usage

theme_edi(base_size = 14, base_family = "Helvetica")

Arguments

base_size

basefont size

base_family

base font family

Examples

library(ggplot2)
p <- ggplot(mtcars) + 
 geom_point(aes(x = wt, y = mpg, 
colour=factor(gear))) + facet_wrap(~am)
p
p + theme_edi()