-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
54 lines (54 loc) · 1.62 KB
/
.Rhistory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
library(tidyverse)
install.packages("tidyverse")
# load libraries to use
library(dplyr)
library(ggplot2)
library(babynames)
most_popular_girls <- babynames |>
filter(sex == "F") |>
group_by(name) |>
summarize(
total_n = sum(n),
) |>
arrange(desc(total_n))
head(most_popular_girls)
ggplot(most_popular_girls, aes(x = reorder(name, total_n), y = total_n)) +
geom_bar(stat = "identity", fill = "steelblue") +
coord_flip() +
labs(
title = "Top 10 Most Popular Girls' Names of All Time",
x = "Name",
y = "Total number of girls",
caption = "Source: Full baby name data provided by the SSA"
) +
theme_minimal()
ggplot(most_popular_girls, aes(x = name, y = total_n)) +
geom_bar(stat = "identity", fill = "steelblue") +
coord_flip() +
labs(
title = "Top 10 Most Popular Girls' Names of All Time",
x = "Name",
y = "Total number of girls",
caption = "Source: Full baby name data provided by the SSA"
) +
theme_minimal()
pop_boy_names <- babynames |>
filter(year == 2017, sex == "M") %>%
arrange(desc(n))
pop_boy_names
babynames %>%
filter(sex != "F", name == "John" | name == "James", na.rm = TRUE) %>%
ggplot(aes(x = year, y = prop, color = name)) +
geom_line() +
theme_minimal() +
labs(
title = "History of the name John and James",
caption = "Source: Full baby name data provided by the SSA"
)
install.packages(c("bslib", "clock", "colorspace", "dials", "future", "ipred", "parallelly", "Rcpp", "shiny", "tinytex", "uuid", "withr", "xfun", "yaml"))
#install required packages
install.packages("tidyverse")
#install required packages
install.packages("tidyverse")
install.packages(‘tidyverse’, dependencies=TRUE)
install.packages("tidyverse", dependencies=TRUE)