Pengenalan data sains
~ TUGAS 1 ~
| *Kontak | *: \(\downarrow\)** |
| e7ilsaudi@gmail.com | |
| https://www.instagram.com/jeremyheryand/ | |
| RPubs | https://rpubs.com/jeremyheriyandi23/ |
Import data
can_lang = read.csv("C:\\Users\\Public\\can_lang.csv")
can_langCreate and organize subsets of tabular data using filter, select, arrange, and slice.
Filter
library(dplyr)
Filter <- filter(can_lang, category == "Aboriginal languages")
Filterselect
Select <- select(Filter, language, mother_tongue)
Select arrange
library(dplyr)
arranged_lang <- arrange(Select, by = desc(mother_tongue))
arranged_langslice
ten_lang <- slice(arranged_lang, 1:10)
ten_langVisualize data with a ggplot bar plot.
library(tidyverse)
# load the data set
can_lang <- read_csv("C:\\Users\\Public\\can_lang.csv")
# obtain the 10 most common Aboriginal languages
aboriginal_lang <- filter(can_lang, category == "Aboriginal languages")
arranged_lang <- arrange(aboriginal_lang, by = desc(mother_tongue))
ten_lang <- slice(arranged_lang, 1:10)
# create the visualization
ggplot(ten_lang, aes(x = mother_tongue,
y = reorder(language, mother_tongue))) +
geom_bar(stat = "identity",fill="blue") +
xlab("Mother Tongue (Number of Canadian Residents)") +
ylab("Language")