-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo.r
28 lines (22 loc) · 1.01 KB
/
demo.r
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
## Marcel Ramos
## YouTube viewing habits
library(lattice)
library(xlsx)
demo <- read.csv("data-raw/YouTubeDemographics.csv", header = TRUE)
demo <- demo[,c("Gender", "Age.group", "Percentage")]
demo$percentage <- as.numeric(unlist(strsplit(as.character(demo$Percentage),
split = "0000%", fixed = TRUE)))
summary(demo$Age.group)
demo$AgeG <- factor(demo$Age.group, levels =
c("18-24", "25-34", "35-44", "45-54", "55-64", "65-"))
barchart(demo$percentage~demo$AgeG, data = demo,
groups = demo$Gender,
auto.key = list(space = "right"),
main = "Demographics by Age Group",
xlab = "Age Group", ylab = "Percentage")
devs <- read.csv("data-raw/YouTubeDevices.csv", header = TRUE)
devs
devs$devper <- round(devs$Views/sum(devs$Views)*100, 2)
survey <- read.xlsx("data-raw/PH750-2SurveyDataRaw.xlsx", sheetIndex = 1,
header = TRUE)
table(survey$What.was.your.preferred.way.to.attend.lectures.for.this.course.)