Überschriften haben wir ja bereits.
Eine Liste
Unter der URL https://upload.wikimedia.org/wikipedia/commons/b/ba/George_Elias_Muller.jpg finden wir ein Bild des Institutsgründers Georg Elias Müller.
Wir können das externe Bild nach dem Download auch einbinden:
Georg Elias Müller
Gefunden auf seiner Wikipedia Seite.
# mini dataframe
dd <- data.frame(
x = c( 2, 1, 3, 4, 5, 7, 6, 8),
y = c( 3, 2, 4, 4, 6, 8, 9, 8),
g = c(rep('m', 4), rep('f', 4))
)
# we want to see the data in dd
dd
## x y g
## 1 2 3 m
## 2 1 2 m
## 3 3 4 m
## 4 4 4 m
## 5 5 6 f
## 6 7 8 f
## 7 6 9 f
## 8 8 8 f
# we can access the columns using the $ operator
dd$y
## [1] 3 2 4 4 6 8 9 8
# some descriptives
mean(dd$x)
## [1] 4.5
sd(dd$x)
## [1] 2.44949
# we can correlate x and y
cor(dd$x, dd$y)
## [1] 0.9354143
# a scatterplot of x and y
plot(dd$x, dd$y)
# boxplots
boxplot(dd$y)
# groupwise boxplot
boxplot(y ~ g, data=dd)
Wenn wir etwas aus R in Markdown brauchen, geht auch das. Die Menge der Beobachtungen in dd
ist 8 (dynamisch ermittelt).
Das Arithmetische Mittel berechnet sich als \(\bar{x} = \frac{\sum{x_i}}{n-1}\) oder als \(\bar{x} = \frac{\sum{x_i}}{n}\) Was macht R’s mean()
?
# we check what mean() does
sum(dd$y) / length(dd$y)
## [1] 5.5
sum(dd$y) / (length(dd$y) - 1)
## [1] 6.285714
mean(dd$y)
## [1] 5.5
Die Lösung: Rmd
Version: 29 März, 2022 13:31