This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# select only specific cols | |
group1 <- "Males" | |
group2 <- "Females" | |
# convert characters to numbers | |
xx <- as.numeric(votesGroup[,group1]) | |
yy <- as.numeric(votesGroup[,group2]) | |
gr <- cut(xx - yy, c(-10,-0.5,0.5,10)) | |
df <- data.frame(x = xx, y = yy, gr = gr, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load the data set with average ratings in groups | |
load("votesGroup.rda") | |
# groups in the data | |
# [1] "Males" "Females" "Aged under 18" "Males under 18" "Females under 18" | |
# [6] "Aged 18-29" "Males Aged 18-29" "Females Aged 18-29" "Aged 30-44" "Males Aged 30-44" | |
# [11] "Females Aged 30-44" "Aged 45+" "Males Aged 45+" "Females Aged 45+" "serialName" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rvest) | |
library(PogromcyDanych) | |
serialsToParse <- levels(serialeIMDB$imdbId) | |
# prepare matrix for results | |
ratingsGroup <- matrix("", length(serialsToParse), 14) | |
rownames(ratingsGroup) <- serialsToParse | |
colnames(ratingsGroup) <- c("Males", "Females", "Aged under 18", "Males under 18", | |
"Females under 18", "Aged 18-29", "Males Aged 18-29", "Females Aged 18-29", | |
"Aged 30-44", "Males Aged 30-44", "Females Aged 30-44", "Aged 45+", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rvest) | |
library(PogromcyDanych) | |
serialsToParse <- levels(serialeIMDB$imdbId) | |
# prepare matrix for results | |
ratingsGroup <- matrix("", length(serialsToParse), 14) | |
rownames(ratingsGroup) <- serialsToParse | |
colnames(ratingsGroup) <- c("Males", "Females", "Aged under 18", "Males under 18", | |
"Females under 18", "Aged 18-29", "Males Aged 18-29", "Females Aged 18-29", | |
"Aged 30-44", "Males Aged 30-44", "Females Aged 30-44", "Aged 45+", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nodes <- html_nodes(page, "table:nth-child(11) td:nth-child(3)") | |
html_text(nodes) | |
as.numeric(gsub(html_text(nodes), pattern="[^0-9\\.]", replacement="")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rvest) | |
page <- html("http://www.imdb.com/title/tt0903747/ratings") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model3 <- candisc(model, "ST04Q01") | |
heplot(model3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(candisc) | |
model2 <- candisc(model, "ST28Q01") | |
heplot(model2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(PISA2012lite) | |
pol <- student2012[student2012$CNT == "Poland",] | |
model <- lm(cbind(PV1MATH, PV1READ, PV1SCIE)~ST28Q01+ST04Q01, pol) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(PISA2012lite) | |
pol <- student2012[student2012$CNT == 'Poland',] | |
model <- lm(cbind(PV1MATH, PV1READ, PV1SCIE)~ST28Q01+ST04Q01, pol) | |
# jeżeli nie jest zainstalowany to | |
# install.packages("heplots") | |
library(heplots) | |
heplot(model, size="effect.size", las=1, term.labels=FALSE) |