- R 語言的視覺化
- 大數據的資料視覺化
- 關於swirl
Wush Wu
國立台灣大學
pie(table(iris$Species))
par(mfrow = c(1, 2))
plot(density(iris$Sepal.Length))
hist(iris$Sepal.Length)
data(Titanic)
mosaicplot(~ Sex + Survived, data = Titanic,
main = "Survival on the Titanic", color = TRUE)
plot(Sepal.Length ~ Species, iris)
plot(dist ~ speed, cars)
plot(iris)
suppressPackageStartupMessages(library(PerformanceAnalytics))
suppressWarnings(chart.Correlation(iris[-5], bg=iris$Species, pch=21))
library(corrplot)
corrplot(cor(mtcars), method = "circle")
plot
和Linear Regressiong <- lm(dist ~ speed, cars)
par(mfrow = c(2,2))
plot(g)
plot
和Regressionplot(cars, main = "lowess(cars)")
lines(lowess(cars), col = 2)
W. S. Cleveland, E. Grosse and W. M. Shyu (1992) Local regression models. Chapter 8 of Statistical Models in S eds J.M. Chambers and T.J. Hastie, Wadsworth & Brooks/Cole.
plot
和RegressionsuppressPackageStartupMessages(library(sm))
with(cars, sm.regression(dist, speed, method = "aicc",
col = "red", model = "linear"))
Bowman, A.W. and Azzalini, A. (1997). Applied Smoothing Techniques for Data Analysis: the Kernel Approach with S-Plus Illustrations. Oxford University Press, Oxford.
plot
和Decision Treelibrary(rpart)
library(rpart.plot)
rpart.plot(rpart(Species ~ ., iris))
library(ade4)
g <- dudi.pca(iris[,-5], scan = FALSE)
scatter(g)
plot
本身能以直角座標系統繪製各種幾何圖形plot
能和模型結合,依據模型的型態繪製各種模型的結果
plot.lm
, rpart::plot.rpart
pie
, hist
, boxplot
, barplot
, ...
lines
, points
, legend
, title
, text
, polygon
, ..
par
data(diamonds, package = "ggplot2")
ggplot(diamonds, aes(x = color)) +
geom_bar()
ggplot(diamonds, aes(x = price)) +
geom_density()
http://stackoverflow.com/questions/19233365/how-to-create-a-marimekko-mosaic-plot-in-ggplot2
ggplot(iris, aes(x = Species, y = Sepal.Width)) +
geom_boxplot()
ggplot(iris, aes(x = Sepal.Width, y = Sepal.Length, color = Species)) +
geom_point()
suppressPackageStartupMessages(library(Rtwmap))
data(county1984)
random.color <- as.factor(sample(1:3, length(county1984), TRUE))
color <- rainbow(3)
county1984$random.color <- random.color
spplot(county1984, "random.color", col.regions = color, main = "Taiwan Random Color")
suppressPackageStartupMessages(library(networkD3))
data(MisLinks)
data(MisNodes)
# Create graph
forceNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source",
Target = "target", Value = "value", NodeID = "name",
Group = "group", opacity = 0.4, zoom = TRUE)
http://www.magesblog.com/2014/03/sankey-diagrams-with-googlevis.html
g <- lm.fit(X, y, ...)
g <- lm(y ~ x1 + x2 + x3, data, ...)
predict(g, data2)
+-:*|^I1
model.matrix
log(dist) ~ I(speed^2)
Mac:
par(family="STKaiti")
+ theme_grey(base_family="STKaiti")
需要透過theme
改字型library(swirl)
delete_progress("<你在swirl所輸入的id>")
uninstall_all_courses()
dst <- tempfile(fileext = ".zip")
download.file("http://www.wush978.idv.tw/DataScienceAndR.zip", dst)
install_course_zip(dst)
swirl()