switch to ggplot2
Closed this issue · 3 comments
romainfrancois commented
romainfrancois commented
@cecilesauder tu peux intégrer ça à l'appli stp ?
romainfrancois commented
C'est mieux si la variable year
est un facteur:
data <- flights %>%
filter( direction == "Outgoing" ) %>%
mutate( year = as.factor(year) ) %>%
group_by( year, month ) %>%
summarise( passengers = sum( passengers ))
ggplot( data ) +
aes( x = month, y = passengers,
group = year, color = year
) +
geom_line() +
geom_point()
romainfrancois commented
data <- flights %>%
filter( direction == "Outgoing" ) %>%
mutate(
year = as.factor(year),
month = factor( month.abb[month], levels = month.abb )
) %>%
group_by( year, month ) %>%
summarise( passengers = sum( passengers ))
ggplot( data ) +
aes( x = month, y = passengers,
group = year, color = year
) +
geom_line() +
geom_point()