# NOT RUN {
library("ie2misc")
# Example 1.18 from Kottegoda (page 15)
obs <- c(50, 56, 42, 53, 49) # annual rainfall in cm
madstat(obs)
require("stats")
set.seed(100) # makes the example reproducible
obs1 <- rnorm(100) # observed
# using the numeric vector obs1
madstat(obs1)
# using a matrix of the numeric vector obs1
mat1 <- matrix(data = obs1, nrow = length(obs1), ncol = 1, byrow = FALSE,
dimnames = list(c(rep("", length(obs1))), "Observed"))
madstat(mat1)
# using a data.frame of the numeric vector obs1
df1 <- data.frame(obs1)
madstat(df1)
library("data.table")
# using a data.table of the numeric vector obs1
df2 <- data.table(obs1)
madstat(df2)
# }
Run the code above in your browser using DataLab