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 |
Function for the geometric mean.
geomean(x, na.rm = TRUE)
geomean(x, na.rm = TRUE)
x |
a numeric vector. |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
The geometric mean is comuted as
numeric vector of length one with the geometric mean.
http://stackoverflow.com/questions/2602583/geometric-mean-is-there-a-built-in
x <- c(1, 10, 100) mean(x) geomean(x)
x <- c(1, 10, 100) mean(x) geomean(x)
Extract numbers from string
numextractall(x)
numextractall(x)
x |
string |
numeric vector
http://stackoverflow.com/questions/19252663/extracting-decimal-numbers-from-a-string
numextractall('1 2 3') numextractall('1,2,3') numextractall('1;2,3 4') numextractall('1;2,3 4,46')
numextractall('1 2 3') numextractall('1,2,3') numextractall('1;2,3 4') numextractall('1;2,3 4,46')
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/.
read_regnie(file)
read_regnie(file)
file |
path to gz archive |
A RasterLayer
object.
# Read daily precipitation on 20.01.2005. r <- read_regnie(system.file("extdata", "ra050120.gz", package = "esmisc"))
# Read daily precipitation on 20.01.2005. r <- read_regnie(system.file("extdata", "ra050120.gz", package = "esmisc"))
Custom ggplot2 theme
theme_edi(base_size = 14, base_family = "Helvetica")
theme_edi(base_size = 14, base_family = "Helvetica")
base_size |
basefont size |
base_family |
base font family |
library(ggplot2) p <- ggplot(mtcars) + geom_point(aes(x = wt, y = mpg, colour=factor(gear))) + facet_wrap(~am) p p + theme_edi()
library(ggplot2) p <- ggplot(mtcars) + geom_point(aes(x = wt, y = mpg, colour=factor(gear))) + facet_wrap(~am) p p + theme_edi()