cis-ds / Discussion

Public discussion
10 stars 15 forks source link

Problem with Final Question Babynames #179

Closed reillyoflaherty closed 2 years ago

reillyoflaherty commented 3 years ago

Hi I am doing the last question on baby names and I am having warnings at the mutate step regarding "name" and errors at geom_vline and scale_x_continous saying I am putting discrete values in for something on a continuous scale. I have not been able to think of a solution to this issue. I think the mutate warning and this may be cocnnnected?

Here is my work

babynames %>%
  filter(sex == "F") %>%
  inner_join(disney, by = c("name" = "princess")) %>%
  mutate(name = fct_reorder(.f = name, .x = release_year)) %>%
  ggplot(mapping = aes(x = year, y = n)) +
  facet_wrap(~name + film, scales = "free_y", labeller = "label_both") +
  geom_line() +
  geom_vline(mapping = aes(xintercept = release_year), linetype = 2, alpha = .5) +
  scale_x_continuous(breaks = c(1880, 1940, 2000)) +
  theme_minimal() +
  labs(title = "Popularity of Disney princess names",
       x = "Year",
       y = "Number of births")
bensoltoff commented 3 years ago

Assuming you fixed the issue with the disney data frame correctly, I don't get any errors when I run this code. Did you try restarting your R session and running the script again?