age <- 42109 r-quiz
R
en
quiz
Schlüsselwörter
Aufgaben, Statistik, Prognose, Modellierung, R, Datenanalyse, Regression
109.0.1 Define a variable
Define in R the variable age and assign the value 42.
Note that spaces here are not mandatory, but useful.
109.0.2 Define a variable as a string
Define in R the variable name and assign the value me.
name <- "me"109.0.3 Define a variable by another variable
Define in R the variable name and assign the variable age.
name <- age109.0.4 Call a function
109.0.5 Define a vector
Define in R a vector x with the values 1,2,3 .
x <- c(1, 2, 3)109.0.6 Sum up vector
109.0.7 Vector wise computation
Square each value in the vector x.
x^2
## [1] 1 4 9109.0.8 Vector wise computation 2
Square each value in the vector x and sum up the values.
sum(x^2)
## [1] 14109.0.9 Compute the variance
109.0.10 Work with NA
Define the vector y with the values 1,2,NA. Compute the mean. Explain the results.