Assessment 1
summary(fortune)
## wealth age region
## Min. : 1.000 Min. : 7.00 A:38
## 1st Qu.: 1.300 1st Qu.: 56.00 E:80
## Median : 1.800 Median : 65.00 M:22
## Mean : 2.684 Mean : 64.03 O:29
## 3rd Qu.: 3.000 3rd Qu.: 72.00 U:63
## Max. :37.000 Max. :102.00
## NA's :7
#adding line
ggplot(aes(x = age, y = wealth, alpha = region), data = fortune) +
geom_point(aes(col = region)) +
geom_vline(xintercept = 64.03) +
geom_hline(yintercept = 2.684)+
theme_bw()
## Warning: Using alpha for a discrete variable is not advised.
## Warning: Removed 7 rows containing missing values (geom_point).

Assessment 2
ggplot(aes(x = age, y = wealth, group = region), data = fortune) +
geom_point(aes(color = region)) +
facet_wrap(~region, nrow = 5) +
geom_smooth(data = filter(fortune),aes(color = region), se = FALSE)+
theme_bw()
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Assessment 3
ggplot(aes(x = happy), data = happy) +
geom_density(aes(fill = love), alpha=0.4) +
theme_bw()

Assessment 4
ggplot(happy, aes(x = love, y = happy, data=sex, fill=sex)) +
geom_point(position = "jitter") +
geom_boxplot(position = "dodge")
## Warning: Continuous x aesthetic -- did you forget aes(group=...)?

Assessment 5
ggplot(happy, aes(x =love, y = happy, color = sex)) +
geom_point(position = "jitter", aes(x =love, y = happy, color = sex)) +
geom_smooth(aes(group = sex), method = lm, se=F, color = "black", fullrange=FALSE) +
theme_bw()
## `geom_smooth()` using formula 'y ~ x'
