Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/scunning1975/mixtape
Browse files Browse the repository at this point in the history
  • Loading branch information
scunning1975 committed Jun 17, 2023
2 parents 8f579da + e0b0751 commit 4f6cb48
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions R/moviestar.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
library(tidyverse)
library(patchwork)

set.seed(3444)

Expand All @@ -10,20 +11,17 @@ star_is_born <- tibble(
star = ifelse(score>=c85,1,0)
)

star_is_born %>%
lm(beauty ~ talent, .) %>%
p1 = star_is_born %>%
ggplot(aes(x = talent, y = beauty)) +
geom_point(size = 0.5, shape=23) + xlim(-4, 4) + ylim(-4, 4)
geom_point(size = 1, alpha = 0.5) + xlim(-4, 4) + ylim(-4, 4) +
geom_smooth(method = 'lm', se = FALSE) +
labs(title = "Everyone")

star_is_born %>%
filter(star == 1) %>%
lm(beauty ~ talent, .) %>%
ggplot(aes(x = talent, y = beauty)) +
geom_point(size = 0.5, shape=23) + xlim(-4, 4) + ylim(-4, 4)

star_is_born %>%
filter(star == 0) %>%
lm(beauty ~ talent, .) %>%
ggplot(aes(x = talent, y = beauty)) +
geom_point(size = 0.5, shape=23) + xlim(-4, 4) + ylim(-4, 4)
p2 = star_is_born %>%
ggplot(aes(x = talent, y = beauty, color = factor(star))) +
geom_point(size = 1, alpha = 0.25) + xlim(-4, 4) + ylim(-4, 4) +
geom_smooth(method = 'lm', se = FALSE) +
labs(title = "Everyone, but different") +
scale_color_discrete(name = 'Star')

p1 + p2

0 comments on commit 4f6cb48

Please sign in to comment.