lesson 8
y<- c(12, 12, 12, 13, 21, 15, 23, 25, 18, 20, 21)
hist(y)

hist(y, col = "green", border = "black", xlab = "age", ylab = "weight", main = "Data science group")

boxplot(y, col = "lightblue", border = "red", xlab = "age", ylab = "weight", main = "Data science group")

plot(density(y, col = "green", border = "black", xlab = "age", ylab = "weight", main = "Data science group"))
## Warning: In density.default(y, col = "green", border = "black", xlab = "age",
## ylab = "weight", main = "Data science group") :
## extra arguments 'col', 'border', 'xlab', 'ylab', 'main' will be disregarded
polygon(y, col = "lightblue", border = "red", xlab = "age", ylab = "weight", main = "Data science group")

poly
## function (x, ..., degree = 1, coefs = NULL, raw = FALSE, simple = FALSE)
## {
## dots <- list(...)
## if (nd <- length(dots)) {
## dots_deg <- nd == 1L && length(dots[[1L]]) == 1L
## if (dots_deg)
## degree <- dots[[1L]]
## else return(polym(x, ..., degree = degree, coefs = coefs,
## raw = raw))
## }
## if (is.matrix(x)) {
## m <- unclass(as.data.frame(if (nd && dots_deg) x else cbind(x,
## ...)))
## return(do.call(polym, c(m, degree = degree, raw = raw,
## list(coefs = coefs))))
## }
## if (degree < 1)
## stop("'degree' must be at least 1")
## if (is.object(x) && mode(x) == "numeric")
## x <- as.numeric(x)
## if (raw) {
## Z <- outer(x, 1L:degree, `^`)
## colnames(Z) <- 1L:degree
## }
## else {
## if (is.null(coefs)) {
## if (anyNA(x))
## stop("missing values are not allowed in 'poly'")
## if (degree >= length(unique(x)))
## stop("'degree' must be less than number of unique points")
## xbar <- mean(x)
## x <- x - xbar
## X <- outer(x, 0L:degree, `^`)
## QR <- qr(X)
## if (QR$rank < degree)
## stop("'degree' must be less than number of unique points")
## z <- QR$qr
## z <- z * (row(z) == col(z))
## Z <- qr.qy(QR, z)
## norm2 <- colSums(Z^2)
## alpha <- (colSums(x * Z^2)/norm2 + xbar)[1L:degree]
## norm2 <- c(1, norm2)
## }
## else {
## alpha <- coefs$alpha
## norm2 <- coefs$norm2
## Z <- matrix(1, length(x), degree + 1L)
## Z[, 2] <- x - alpha[1L]
## if (degree > 1)
## for (i in 2:degree) Z[, i + 1] <- (x - alpha[i]) *
## Z[, i] - (norm2[i + 1]/norm2[i]) * Z[, i -
## 1]
## }
## Z <- Z/rep(sqrt(norm2[-1L]), each = length(x))
## colnames(Z) <- 0L:degree
## Z <- Z[, -1, drop = FALSE]
## if (!simple)
## attr(Z, "coefs") <- list(alpha = alpha, norm2 = norm2)
## }
## if (simple)
## Z
## else structure(Z, degree = 1L:degree, class = c("poly", "matrix"))
## }
## <bytecode: 0x000001e1b018c7a0>
## <environment: namespace:stats>
library(vioplot)
## Warning: package 'vioplot' was built under R version 4.4.3
## Loading required package: sm
## Warning: package 'sm' was built under R version 4.4.3
## Package 'sm', version 2.2-6.0: type help(sm) for summary information
## Loading required package: zoo
## Warning: package 'zoo' was built under R version 4.4.3
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
vioplot(y, col = "lightblue", border = "red", xlab = "age", ylab = "weight", main = "Data science group")

library(beanplot)
## Warning: package 'beanplot' was built under R version 4.4.3
beanplot(y, col = "lightblue", border = "red", xlab = "age", ylab = "weight", main = "Data science group")

library(beeswarm)
beeswarm(y, col = "black", border = "red", xlab = "age", ylab = "weight", main = "Data science group")
## Warning in plot.window(...): "border" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "border" is not a graphical parameter
## Warning in title(...): "border" is not a graphical parameter
## Warning in axis(2, ...): "border" is not a graphical parameter
## Warning in axis(1, at = at, labels = labels, tick = FALSE, ...): "border" is
## not a graphical parameter
## Warning in box(...): "border" is not a graphical parameter
