R Cheat Sheet For The Ethiosis Crash Course On DSM: Organizing Data
R Cheat Sheet For The Ethiosis Crash Course On DSM: Organizing Data
or consult the internet! The first 5 rows and first 8 columns can be obtained
by means of
All functions and data sets in R are organised in ## long lat pH OM ECEC N Al B
packages. Packages are organised in libraries. A ## 1 35.56 10.67 5.72 4.58 14.28 0.10 1610 0.10
package can be attached to your R-session by call- ## 2 35.79 12.28 6.98 2.79 45.61 0.09 766 0.10
ing the library function: ## 3 35.81 12.28 6.76 3.37 41.87 0.15 774 0.10
## 4 35.82 12.27 6.78 2.70 44.15 0.11 867 0.10
library(ethiosis) # attach ethiosis-package ## 5 35.83 12.28 7.19 3.65 25.98 0.11 666 0.26
1
cor, log, sqrt. See the help files for more details. Variography and Kriging
An example
a <- 3
A useful package for geostatistical analysis is the
a gstat-package. The following functions are useful
for our course:
## [1] 3
variogram: variogram estimation
b <- a + 1:5
b fit.variogram: variogram modelling
## [1] 4 5 6 7 8 krige: various types of kriging (and simulation)
sqrt(b) krige.cv: cross-validation
## [1] 2.000 2.236 2.449 2.646 2.828
## [1] 1197
dim(map_ata)
## [1] 1197 20
Linear Regression
Linear regression can be done by means of the lm
function. In addition, many functions are available
to extract useful information from lm objects:
AIC: Akaike’s An Information Criterion
fitted: extracts model fitted values
residuals: extracts model residuals
influence: regression diagnostics
predict: model predictions