10 Code
## [1] TRUE FALSE
## [1] 0 1
## [1] 0.0 1.1
## [1] 1e-10 1e+10
## [1] "maandag" "dinsdag" "woensdag"
## [1] maandag dinsdag woensdag
## Levels: dinsdag maandag woensdag
# function
my_fun <- function(x){
cat("mijn functie is", x)
}
# data.frame
state <- data.frame(
region = state.region,
Division = state.division,
state.x77
)
# function
my_fun("cool")
## mijn functie is cool
## dit is een boodschap
## Warning: dit is een waarschuwing
## Error in eval(expr, envir, enclos): dit is een foutmelding
# programma flow
if (is.data.frame(state)) {
summary(state)
} else {
stop("state is not a data.frame")
}
## region Division Population Income
## Northeast : 9 South Atlantic : 8 Min. : 365 Min. :3098
## South :16 Mountain : 8 1st Qu.: 1080 1st Qu.:3993
## North Central:12 West North Central: 7 Median : 2838 Median :4519
## West :13 New England : 6 Mean : 4246 Mean :4436
## East North Central: 5 3rd Qu.: 4968 3rd Qu.:4814
## Pacific : 5 Max. :21198 Max. :6315
## (Other) :11
## Illiteracy Life.Exp Murder HS.Grad
## Min. :0.500 Min. :67.96 Min. : 1.400 Min. :37.80
## 1st Qu.:0.625 1st Qu.:70.12 1st Qu.: 4.350 1st Qu.:48.05
## Median :0.950 Median :70.67 Median : 6.850 Median :53.25
## Mean :1.170 Mean :70.88 Mean : 7.378 Mean :53.11
## 3rd Qu.:1.575 3rd Qu.:71.89 3rd Qu.:10.675 3rd Qu.:59.15
## Max. :2.800 Max. :73.60 Max. :15.100 Max. :67.30
##
## Frost Area
## Min. : 0.00 Min. : 1049
## 1st Qu.: 66.25 1st Qu.: 36985
## Median :114.50 Median : 54277
## Mean :104.46 Mean : 70736
## 3rd Qu.:139.75 3rd Qu.: 81162
## Max. :188.00 Max. :566432
##
## i = 1
## i = 2
## i = 3
## i = 4
## i = 5
Onkelinx, T. (2021). https://doi.org/10.5281/zenodo.842223