Skip to content

Instantly share code, notes, and snippets.

View philipp-baumann's full-sized avatar
:atom:
Sensing the environment. WhoeverWhatever-Cares.

Philipp Baumann philipp-baumann

:atom:
Sensing the environment. WhoeverWhatever-Cares.
View GitHub Profile
@philipp-baumann
philipp-baumann / Dockerfile
Created October 6, 2019 16:00
Dockerfile for "A new method for estimating the water retention characteristics and water holding capacity of soils"
# Pull docker image (includes RStudio server)
FROM rocker/rstudio:3.6.0
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libz-dev \
libxml2-dev
ENV RENV_VERSION 0.7.0-111
RUN R -e "install.packages('remotes', repos = c(CRAN = 'https://cloud.r-project.org'))"
@philipp-baumann
philipp-baumann / cubist-special-chars-exception.R
Last active January 19, 2019 04:15
Cubist: Special character values in factorial predictors
pkgs <- c("mlbench", "Cubist")
lapply(pkgs, library, character.only = TRUE)
# Example data set
data(BostonHousing)
# Test with only 2 factorial predictors
boston_housing <- BostonHousing[, c("crim", "zn", "medv")]
# Convert numeric `crim` and `zn` to factors
boston_housing$zn <- as.factor(boston_housing$zn)
boston_housing$crim <- as.factor(boston_housing$crim)
################################################################################
## Task: Select reference samples for soil refence analyses by using
## Kennard-Stones
## sampling algorithm on preprocessed spectra in PCA space
################################################################################
# Load packages
library("tidyverse")
library("simplerspec")
@philipp-baumann
philipp-baumann / 02_predict-from-spectra-example.R
Created December 29, 2017 11:55
Predict from spectra and calibrated models
################################################################################
## Task: Example script to predict spectra in simplerspec framework
################################################################################
# Remove all R objects from memory
rm(list = ls())
# Load packages
pkgs <- c("tidyverse", "simplerspec")
lapply(pkgs, library, character.only = TRUE)
@philipp-baumann
philipp-baumann / 01_visualize-spectra.R
Last active December 29, 2017 11:47
Visualize spectra
################################################################################
## Task: Example script to visualize spectra in simplerspec framework
################################################################################
# Remove all R objects from memory
rm(list = ls())
# Load packages
pkgs <- c("tidyverse", "simplerspec")
lapply(pkgs, library, character.only = TRUE)