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(ggplot2) | |
movies <- movies[1:1000,] | |
m <- ggplot(movies, aes(x=rating)) | |
m + geom_histogram(binwidth=0.2, colour = "darkgreen", fill = "white", size=1) + geom_rug(aes(y=-2), position="jitter", sides="b") |
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(ggplot2) | |
movies <- movies[1:1000,] | |
m <- ggplot(movies, aes(x=rating)) | |
m + geom_histogram(binwidth=0.2, colour = "darkgreen", fill = "white", size=1) + geom_point(aes(y = -2), position = position_jitter(height = 0.8), size=1) |
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(ggplot2) | |
# create fictitious data | |
a <- runif(10) | |
b <- runif(12) | |
c <- runif(7) | |
d <- runif(15) | |
# data groups | |
group <- factor(rep(1:4, c(10, 12, 7, 15))) |
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
#Type: | |
# (1) wac36 = Weight-for-age charts, birth to 36 months | |
# (2) lac36 = Length-for-age charts, birth to 36 months | |
# (3) wlc = Weight-for-recumbent length charts, birth to 36 months | |
# (4) hac = Head circumference-for-age charts, birth to 36 months | |
# (5) wsc = Weight-for-stature charts | |
# (6) wac20 = Weight-for-age charts, 2 to 20 years | |
# (7) lac20 = Stature-for-age charts, 2 to 20 years | |
# (8) bac = BMI-for-age charts, 2 to 20 years | |
# (9) bmi.adv = wac20 + lac20 + bac (for pdf export) |
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
#Type: | |
# (1) wac36 = Weight-for-age charts, birth to 36 months | |
# (2) lac36 = Length-for-age charts, birth to 36 months | |
# (3) wlc = Weight-for-recumbent length charts, birth to 36 months | |
# (4) hac = Head circumference-for-age charts, birth to 36 months | |
# (5) wsc = Weight-for-stature charts | |
# (6) wac20 = Weight-for-age charts, 2 to 20 years | |
# (7) lac20 = Stature-for-age charts, 2 to 20 years | |
# (8) bac = BMI-for-age charts, 2 to 20 years | |
# |
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
PlayTel <- function(x=character){ | |
# load package | |
require(sound) | |
# control if the input is a character | |
if (!is.character(x)) stop("x must be a character") | |
# split the input | |
num <- strsplit(as.character(x), "") |
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
# Sierra3 dithering | |
Sierra3Convolution <- function(a){ | |
c <- matrix(0, nrow=dim(a)[1], ncol=dim(a)[2]) | |
for(i in 2:(dim(a)[1]-2)){ | |
for(j in 2:(dim(a)[2]-2)){ | |
P <- trunc(a[i,j]+0.5) | |
e <- a[i,j] - P |
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
# Sierra2 dithering | |
Sierra2Convolution <- function(a){ | |
c <- matrix(0, nrow=dim(a)[1], ncol=dim(a)[2]) | |
for(i in 2:(dim(a)[1]-2)){ | |
for(j in 2:(dim(a)[2]-2)){ | |
P <- trunc(a[i,j]+0.5) | |
e <- a[i,j] - P |
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
# Burkes dithering | |
BurkesConvolution <- function(a){ | |
c <- matrix(0, nrow=dim(a)[1], ncol=dim(a)[2]) | |
for(i in 2:(dim(a)[1]-2)){ | |
for(j in 2:(dim(a)[2]-2)){ | |
P <- trunc(a[i,j]+0.5) | |
e <- a[i,j] - P |
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
# Stucki dithering | |
StuckiConvolution <- function(a){ | |
c <- matrix(0, nrow=dim(a)[1], ncol=dim(a)[2]) | |
for(i in 2:(dim(a)[1]-2)){ | |
for(j in 2:(dim(a)[2]-2)){ | |
P <- trunc(a[i,j]+0.5) | |
e <- a[i,j] - P |
NewerOlder