Zun??chst gilt es die Daten einzulesen und entsprechende Packete zu laden.
devtools::install_github("DataWookie/lifespan")
## Skipping install of 'lifespan' from a github remote, the SHA1 (fe475325) has not changed since last install.
## Use `force = TRUE` to force installation
library(lifespan)
library(ggplot2)
head(deaths)
## year month sex count avgage medage maxage
## 1 1994 Jan F 117373 76.05143 80 112
## 2 1994 Jan M 116849 68.34154 73 111
## 3 1994 Feb F 91778 75.32554 79 115
## 4 1994 Feb M 94566 67.47707 72 110
## 5 1994 Mar F 95402 74.82837 79 114
## 6 1994 Mar M 99881 66.83180 72 116
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
ggplot(deaths, aes(x = year, y = avgage)) + geom_boxplot(aes(group = year, fill = sex)) + facet_wrap(~ sex)+ labs(x = "", y = "Average Age at Death")+ theme_minimal() + theme(legend.title = element_blank())
You can also embed plots, for example:
# death months
ggplot(deaths, aes(x = month, y = avgage)) + geom_boxplot(aes(group = month, fill = sex)) + facet_wrap(~ sex)+ labs(x = "mounth", y = "Average Age at Death")+ theme_minimal() + theme(legend.title = element_blank())
Hier sehen wir die Tode nach Monat aufgeschl??sselt.