SlideShare una empresa de Scribd logo
1 de 33
Descargar para leer sin conexión
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
R Language Definition
OOP
黄湘云
Department of Statistics
China University of Mining & Technology,Beijing
May 4, 2016
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
目录
1 安装 R 包
2 获取数据
3 统计绘图
4 统计计算
5 R 语言定义
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
安装 R 包
从指定网站安装 R 包
install.packages("ggplot2",repos = "https://mirrors.tuna.tsinghua.edu.cn/CRAN/")
install.packages("pim",repos = "http://www.r-forge.r-project.org/",lib = "D:/library/")
一行命令安装 cran 上所有的 Packages
install.packages(setdiff(available.packages()[,1],
.packages(all.available = TRUE)))
安装 Bioconductor 上的 R 包
source("https://bioconductor.org/biocLite.R")
library(BiocInstaller)
biocLite("ggtree")
安装 Github 上的 R 包
library(devtools)
install_github("ropensci/aRxiv")
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
安装注意几项
依赖问题 主要针对离线安装和源码编译安装
平台问题 有些 R 包只能装在类 unix 操作系统上
软件问题 有些 R 包要求相应 R 软件版本
特定库依赖 如 gputools 包依赖 cuda 库
# OS information
Sys.info()
sysname release version nodename
"Windows" "10 x64" "build 10586" "LENOVO-PC"
machine login user effective_user
"x86-64" "Xiangyun Huang" "Xiangyun Huang" "Xiangyun Huang"
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
R 软件信息
> version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 2.5
year 2016
month 04
day 14
svn rev 70478
language R
version.string R version 3.2.5 (2016-04-14)
nickname Very, Very Secure Dishes
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
目录
1 安装 R 包
2 获取数据
3 统计绘图
4 统计计算
5 R 语言定义
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
R 软件系统自带的数据集
# view R data sets
length(data(package = .packages(all.available = TRUE))$results[,3])
## [1] 20969
# extended packages
library(ggplot2)
data("diamonds")
head(diamonds)
## carat cut color clarity depth table price x y z
## 1 0.23 Ideal E SI2 61.5 55 326 3.95 3.98 2.43
## 2 0.21 Premium E SI1 59.8 61 326 3.89 3.84 2.31
## 3 0.23 Good E VS1 56.9 65 327 4.05 4.07 2.31
## 4 0.29 Premium I VS2 62.4 58 334 4.20 4.23 2.63
## 5 0.31 Good J SI2 63.3 58 335 4.34 4.35 2.75
## 6 0.24 Very Good J VVS2 62.8 57 336 3.94 3.96 2.48
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
目录
1 安装 R 包
2 获取数据
3 统计绘图
4 统计计算
5 R 语言定义
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
plot 函数–pch
点
26 shaps of points
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
plot 函数–lty–lwd
线
0 10 20 30 40 50
−1.5−1.0−0.50.00.51.01.52.0
Simple Use of Color In a Plot
Just a Whisper of a Label
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
调色板–连续型
Blues
BuGn
BuPu
GnBu
Greens
Greys
Oranges
OrRd
PuBu
PuBuGn
PuRd
Purples
RdPu
Reds
YlGn
YlGnBu
YlOrBr
YlOrRd
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
调色板–极端型
BrBG
PiYG
PRGn
PuOr
RdBu
RdGy
RdYlBu
RdYlGn
Spectral
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
调色板–离散型
Accent
Dark2
Paired
Pastel1
Pastel2
Set1
Set2
Set3
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
举个栗子
barplot(sample(seq(20),6,replace = T),col=brewer.pal(11, "BrBG")[3:8])
05101520
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
再举个栗子
Set3 3 colors
VADeaths
Frequency
10 20 30 40 50 60 70
0.00.51.01.52.02.53.0
Set2 3 colors
VADeaths
Frequency
0 20 40 60 8002468
Set1 3 colors
VADeaths
Frequency
0 20 40 60 80
0123456
Set3 8 colors
VADeaths
Frequency
0 20 40 60 80 100
051015
Greys 8 colors
VADeaths
Frequency
0 20 40 60 80
0123456
Greens 8 colors
VADeaths
Frequency
0 20 40 60 80
0123456
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
继续举个栗子
Sepal.Length
2.0 2.5 3.0 3.5 4.0 0.5 1.0 1.5 2.0 2.5
4.55.56.57.5
2.03.04.0
Sepal.Width
Petal.Length
1234567
0.51.52.5
Petal.Width
4.5 5.5 6.5 7.5 1 2 3 4 5 6 7 1.0 1.5 2.0 2.5 3.0
1.02.03.0
Species
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
三维图–persp
X
−10
−5
0
5
10
Y
−10
−5
0
5
10
Z
−2
0
2
4
6
8
.
z = Sinc( x2
+ y2
)
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
添加数学公式
−3 −2 −1 0 1 2 3
0.00.10.20.30.4
Normal Probability Density Function
x
dnorm(x)
f(x) =
1
2πσ2
e
−(x−µ)2
2σ2
−3 −2 −1 0 1 2 3
0.00.20.40.60.81.0
Normal Cumulative Distribution Function
x
cumsum(x)/sum(x)
φ(x) =
1
2π
⌠
⌡−∞
x
e(−t2
2)
dt
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
anscombe 数据
4 6 8 10 12 14
4567891011
x1
y1
y1 = 3 + 0.5x1
4 6 8 10 12 14
3456789
x1
y2
y2 = 3 + 0.5x1
4 6 8 10 12 14
681012
x1
y3
y3 = 3 + 0.5x1
8 10 12 14 16 18
681012
x4
y4
y4 = 3 + 0.5x4
σ^2
= 1.531,Multiple R2
= 0.667,Adjusted R2
= 0.629
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
barplot
cardiothoracic gastrointestinal neuro other trauma
Types of surgery
Absolutefrequency
050100150200
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
barplot
0
10
20
30
40
cardiothoracic gastrointestinal neuro other trauma
surgery
Relativefrequencyin%
Types of surgery
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
目录
1 安装 R 包
2 获取数据
3 统计绘图
4 统计计算
5 R 语言定义
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
多元概率分布函数
The multivariate t distribution (MVT) is given by
T(a, b, Σ, ν) =
21− ν
2
Γ(ν
2 )
∫ ∞
0
sν−1
e− s2
2 Φ(
sa
√
ν
,
sb
√
ν
, Σ)ds
multivariate normal distribution function (MVN)
Φ(a, b, Σ) =
1
√
|Σ|(2π)m
∫ b1
a1
∫ b2
a2
· · ·
∫ bm
am
e−1
2
x⊤Σ−1x
dx
x = (x1, x2, . . . , xm)⊤, −∞ ≤ ai ≤ bi ≤ ∞ for all i, and Σ is a
positive semi-definite symmetric m × m matrix
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
计算多元正态分布的概率
library(mvtnorm)
library(matrixcalc)
path<-"C:/Users/Xiangyun Huang/Desktop/LanguageDefinitionR/"
setwd(path)
sigma <- read.csv(file="data/sigma1.csv",header=F, sep=",")
mat<-matrix(0,nrow = nrow(sigma),ncol = ncol(sigma))
sigma <- as.matrix(sigma)
attributes(sigma)<-attributes(mat)
# str(sigma)
# is.symmetric.matrix(sigma)
# is.positive.definite(sigma)
m = nrow(sigma)
Fn = pmvnorm(lower=rep(-Inf, m), upper=rep(0, m),
mean=rep(0, m), sigma =sigma)
Fn
## [1] 6.748008e-29
## attr(,"error")
## [1] 2.48407e-31
## attr(,"msg")
## [1] "Normal Completion"
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
多元 t 分布分位数计算
n <- c(26, 24, 20, 33, 32)
V <- diag(1/n); df <- 130
C <- matrix(c(1,1,1,0,0,-1,0,0,1,0,
0,-1,0,0,1,0,0,0,-1,-1,
0,0,-1,0,0),ncol=5)
cv <- C %*% V %*% t(C) ## covariance matrix
dv <- t(1/sqrt(diag(cv)))
cr <- cv * (t(dv) %*% dv) ## correlation matrix
delta <- rep(0,5)
Tn<-qmvt(0.95, df = df, delta = delta, corr = cr,
abseps = 0.0001,maxpts = 100000, tail = "both")
Tn
## $quantile
## [1] 2.560946
##
## $f.quantile
## [1] 1.523691e-07
##
## attr(,"message")
## [1] "Normal Completion"
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
目录
1 安装 R 包
2 获取数据
3 统计绘图
4 统计计算
5 R 语言定义
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
谈谈对象
class(sigma) #Object Classes
## [1] "matrix"
str(sigma) #Compactly Display the Structure of an Arbitrary R Object
## num [1:83, 1:83] 0.3806 -0.0104 0 0 0 ...
mode(sigma) #The (Storage) Mode of an Object
## [1] "numeric"
typeof(sigma) #The Type of an Object
## [1] "double"
attributes(sigma) #Object Attribute Lists
## $dim
## [1] 83 83
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
pryr 包撬开 R 的底层
pryr: Useful tools to pry back the covers of R and understand
the language at a deeper level.
c(is.list(sigma),is.matrix(sigma))
## [1] FALSE TRUE
c(is.vector(sigma),is.numeric(sigma))
## [1] FALSE TRUE
c(is.array(sigma),is.data.frame(sigma))
## [1] TRUE FALSE
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
撬开 tabulate 函数
tabulate
## function (bin, nbins = max(1L, bin, na.rm = TRUE))
## {
## if (!is.numeric(bin) && !is.factor(bin))
## stop("'bin' must be numeric or a factor")
## if (typeof(bin) != "integer")
## bin <- as.integer(bin)
## if (nbins > .Machine$integer.max)
## stop("attempt to make a table with >= 2^31 elements")
## nbins <- as.integer(nbins)
## if (is.na(nbins))
## stop("invalid value of 'nbins'")
## .Internal(tabulate(bin, nbins))
## }
## <bytecode: 0x0000000016e96018>
## <environment: namespace:base>
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
撬开 tabulate 函数
library(pryr)
show_c_source(.Internal(tabulate(bin,nbins)))
SEXP attribute_hidden do_tabulate(SEXP call, SEXP op, SEXP args, SEXP rho)
{
checkArity(op, args);
SEXP in = CAR(args), nbin = CADR(args);
if (TYPEOF(in) != INTSXP) error("invalid input");
R_xlen_t n = XLENGTH(in);
/* FIXME: could in principle be a long vector */
int nb = asInteger(nbin);
if (nb == NA_INTEGER || nb < 0)
error(_("invalid '%s' argument"), "nbin");
SEXP ans = allocVector(INTSXP, nb);
int *x = INTEGER(in), *y = INTEGER(ans);
if (nb) memset(y, 0, nb * sizeof(int));
for(R_xlen_t i = 0 ; i < n ; i++)
if (x[i] != NA_INTEGER && x[i] > 0 && x[i] <= nb) y[x[i] - 1]++;
return ans;
}
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
撬开 plot
methods(plot)
## [1] plot,ANY-method plot,color-method plot.acf*
## [4] plot.data.frame* plot.decomposed.ts* plot.default
## [7] plot.dendrogram* plot.density* plot.ecdf
## [10] plot.factor* plot.formula* plot.function
## [13] plot.ggplot* plot.gtable* plot.hclust*
## [16] plot.histogram* plot.HoltWinters* plot.isoreg*
## [19] plot.lm* plot.medpolish* plot.mlm*
## [22] plot.ppr* plot.prcomp* plot.princomp*
## [25] plot.profile.nls* plot.raster* plot.spec*
## [28] plot.stepfun plot.stl* plot.table*
## [31] plot.ts plot.tskernel* plot.TukeyHSD*
## see '?methods' for accessing help and source code
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
visible from generic isS4
plot,ANY-method TRUE graphics plot TRUE
plot,color-method TRUE colorspace plot TRUE
plot.acf FALSE registered S3method for plot plot FALSE
plot.data.frame FALSE registered S3method for plot plot FALSE
plot.decomposed.ts FALSE registered S3method for plot plot FALSE
plot.default TRUE graphics plot FALSE
plot.dendrogram FALSE registered S3method for plot plot FALSE
plot.density FALSE registered S3method for plot plot FALSE
plot.ecdf TRUE stats plot FALSE
plot.factor FALSE registered S3method for plot plot FALSE
plot.formula FALSE registered S3method for plot plot FALSE
plot.function TRUE graphics plot FALSE
plot.ggplot FALSE registered S3method for plot plot FALSE
plot.gtable FALSE registered S3method for plot plot FALSE
plot.hclust FALSE registered S3method for plot plot FALSE
plot.histogram FALSE registered S3method for plot plot FALSE
plot.HoltWinters FALSE registered S3method for plot plot FALSE
plot.isoreg FALSE registered S3method for plot plot FALSE
plot.lm FALSE registered S3method for plot plot FALSE
plot.medpolish FALSE registered S3method for plot plot FALSE
plot.mlm FALSE registered S3method for plot plot FALSE
plot.ppr FALSE registered S3method for plot plot FALSE
plot.prcomp FALSE registered S3method for plot plot FALSE
plot.princomp FALSE registered S3method for plot plot FALSE
plot.profile.nls FALSE registered S3method for plot plot FALSE
plot.raster FALSE registered S3method for plot plot FALSE
plot.spec FALSE registered S3method for plot plot FALSE
plot.stepfun TRUE stats plot FALSE
plot.stl FALSE registered S3method for plot plot FALSE
plot.table FALSE registered S3method for plot plot FALSE
plot.ts TRUE stats plot FALSE
plot.tskernel FALSE registered S3method for plot plot FALSE
plot.TukeyHSD FALSE registered S3method for plot plot FALSE
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
安装 R 包 获取数据 统计绘图 统计计算 R 语言定义
统计计算环境
> devtools::session_info()$packages
package * version date source
colorspace 1.2-6 2015-03-11 CRAN (R 3.2.4)
devtools 1.11.0 2016-04-12 CRAN (R 3.2.4)
digest 0.6.9 2016-01-08 CRAN (R 3.2.4)
evaluate 0.9 2016-04-29 CRAN (R 3.2.5)
formatR 1.3 2016-03-05 CRAN (R 3.2.4)
ggplot2 * 2.1.0 2016-03-01 CRAN (R 3.2.4)
gtable 0.2.0 2016-02-26 CRAN (R 3.2.4)
highr 0.5.1 2015-09-18 CRAN (R 3.2.4)
knitr * 1.12.27 2016-05-01 Github (yihui/knitr@5a0a689)
labeling 0.3 2014-08-23 CRAN (R 3.2.3)
magrittr 1.5 2014-11-22 CRAN (R 3.2.3)
matrixcalc * 1.0-3 2012-09-15 CRAN (R 3.2.3)
memoise 1.0.0 2016-01-29 CRAN (R 3.2.3)
munsell 0.4.3 2016-02-13 CRAN (R 3.2.3)
mvtnorm * 1.0-5 2016-02-02 CRAN (R 3.2.3)
plyr 1.8.3 2015-06-12 CRAN (R 3.2.3)
RColorBrewer * 1.1-2 2014-12-07 CRAN (R 3.2.3)
Rcpp 0.12.4 2016-03-26 CRAN (R 3.2.4)
scales 0.4.0 2016-02-26 CRAN (R 3.2.3)
stringi 1.0-1 2015-10-22 CRAN (R 3.2.3)
stringr 1.0.0 2015-04-30 CRAN (R 3.2.3)
withr 1.0.1 2016-02-04 CRAN (R 3.2.3)

Más contenido relacionado

La actualidad más candente (13)

Ch2 教學
Ch2 教學Ch2 教學
Ch2 教學
 
Ch5 範例
Ch5 範例Ch5 範例
Ch5 範例
 
Ch8 教學
Ch8 教學Ch8 教學
Ch8 教學
 
Ch6 教學
Ch6 教學Ch6 教學
Ch6 教學
 
Ch9 範例
Ch9 範例Ch9 範例
Ch9 範例
 
Ch11 教學
Ch11 教學Ch11 教學
Ch11 教學
 
Ch12 範例
Ch12 範例Ch12 範例
Ch12 範例
 
Ch5 習題
Ch5 習題Ch5 習題
Ch5 習題
 
第5章数组
第5章数组第5章数组
第5章数组
 
Ch12 教學
Ch12 教學Ch12 教學
Ch12 教學
 
Ch11 範例
Ch11 範例Ch11 範例
Ch11 範例
 
Num py basic(2) - v01
Num py   basic(2) - v01Num py   basic(2) - v01
Num py basic(2) - v01
 
Ppt 101-119
Ppt 101-119Ppt 101-119
Ppt 101-119
 

Similar a R Language definition

R統計軟體簡介
R統計軟體簡介R統計軟體簡介
R統計軟體簡介Person Lin
 
51 cto下载 2010-ccna实验手册
51 cto下载 2010-ccna实验手册51 cto下载 2010-ccna实验手册
51 cto下载 2010-ccna实验手册poker mr
 
PostgreSQL Introduction V0.1
PostgreSQL Introduction V0.1PostgreSQL Introduction V0.1
PostgreSQL Introduction V0.1March Liu
 
8门编程语言的设计思考
8门编程语言的设计思考8门编程语言的设计思考
8门编程语言的设计思考Ray Song
 
Linux 期末報告
Linux 期末報告Linux 期末報告
Linux 期末報告米米 林
 
Java eye新闻月刊 2009年08月 - 总第18期
Java eye新闻月刊   2009年08月 - 总第18期Java eye新闻月刊   2009年08月 - 总第18期
Java eye新闻月刊 2009年08月 - 总第18期lileinba
 
Pl sql developer7.0用户指南
Pl sql developer7.0用户指南Pl sql developer7.0用户指南
Pl sql developer7.0用户指南irons_zhou
 
C/C++调试、跟踪及性能分析工具综述
C/C++调试、跟踪及性能分析工具综述C/C++调试、跟踪及性能分析工具综述
C/C++调试、跟踪及性能分析工具综述Xiaozhe Wang
 
GCC_Porting_on_MiniSystem
GCC_Porting_on_MiniSystemGCC_Porting_on_MiniSystem
GCC_Porting_on_MiniSystemXiaojing Ma
 
本書特色適用讀者
本書特色適用讀者本書特色適用讀者
本書特色適用讀者sugeladi
 
Bigdata 大資料分析實務 (進階上機課程)
Bigdata 大資料分析實務 (進階上機課程)Bigdata 大資料分析實務 (進階上機課程)
Bigdata 大資料分析實務 (進階上機課程)家雋 莊
 
Ubuntu手册(中文版)
Ubuntu手册(中文版)Ubuntu手册(中文版)
Ubuntu手册(中文版)byp2011
 
Java eye新闻月刊 -_2010年01月_-_总第23期
Java eye新闻月刊 -_2010年01月_-_总第23期Java eye新闻月刊 -_2010年01月_-_总第23期
Java eye新闻月刊 -_2010年01月_-_总第23期JianXiong Ma
 
Ocs7.1 id消费系统说明书 20110106
Ocs7.1 id消费系统说明书 20110106Ocs7.1 id消费系统说明书 20110106
Ocs7.1 id消费系统说明书 20110106qq511673969
 
Java eye新闻月刊 2011年01月 - 总第35期
Java eye新闻月刊   2011年01月 - 总第35期Java eye新闻月刊   2011年01月 - 总第35期
Java eye新闻月刊 2011年01月 - 总第35期JianXiong Ma
 
Bind9 chs
Bind9 chsBind9 chs
Bind9 chsTom Lee
 

Similar a R Language definition (20)

R統計軟體簡介
R統計軟體簡介R統計軟體簡介
R統計軟體簡介
 
51 cto下载 2010-ccna实验手册
51 cto下载 2010-ccna实验手册51 cto下载 2010-ccna实验手册
51 cto下载 2010-ccna实验手册
 
PostgreSQL Introduction V0.1
PostgreSQL Introduction V0.1PostgreSQL Introduction V0.1
PostgreSQL Introduction V0.1
 
8门编程语言的设计思考
8门编程语言的设计思考8门编程语言的设计思考
8门编程语言的设计思考
 
Linux 期末報告
Linux 期末報告Linux 期末報告
Linux 期末報告
 
Phpunit book
Phpunit bookPhpunit book
Phpunit book
 
Java eye新闻月刊 2009年08月 - 总第18期
Java eye新闻月刊   2009年08月 - 总第18期Java eye新闻月刊   2009年08月 - 总第18期
Java eye新闻月刊 2009年08月 - 总第18期
 
Pl sql developer7.0用户指南
Pl sql developer7.0用户指南Pl sql developer7.0用户指南
Pl sql developer7.0用户指南
 
C/C++调试、跟踪及性能分析工具综述
C/C++调试、跟踪及性能分析工具综述C/C++调试、跟踪及性能分析工具综述
C/C++调试、跟踪及性能分析工具综述
 
GCC_Porting_on_MiniSystem
GCC_Porting_on_MiniSystemGCC_Porting_on_MiniSystem
GCC_Porting_on_MiniSystem
 
Ipaq with linux
Ipaq with linuxIpaq with linux
Ipaq with linux
 
本書特色適用讀者
本書特色適用讀者本書特色適用讀者
本書特色適用讀者
 
Bigdata 大資料分析實務 (進階上機課程)
Bigdata 大資料分析實務 (進階上機課程)Bigdata 大資料分析實務 (進階上機課程)
Bigdata 大資料分析實務 (進階上機課程)
 
Ubuntu手册(中文版)
Ubuntu手册(中文版)Ubuntu手册(中文版)
Ubuntu手册(中文版)
 
Twido programming guide
Twido programming guideTwido programming guide
Twido programming guide
 
Fluxay
FluxayFluxay
Fluxay
 
Java eye新闻月刊 -_2010年01月_-_总第23期
Java eye新闻月刊 -_2010年01月_-_总第23期Java eye新闻月刊 -_2010年01月_-_总第23期
Java eye新闻月刊 -_2010年01月_-_总第23期
 
Ocs7.1 id消费系统说明书 20110106
Ocs7.1 id消费系统说明书 20110106Ocs7.1 id消费系统说明书 20110106
Ocs7.1 id消费系统说明书 20110106
 
Java eye新闻月刊 2011年01月 - 总第35期
Java eye新闻月刊   2011年01月 - 总第35期Java eye新闻月刊   2011年01月 - 总第35期
Java eye新闻月刊 2011年01月 - 总第35期
 
Bind9 chs
Bind9 chsBind9 chs
Bind9 chs
 

R Language definition

  • 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 R Language Definition OOP 黄湘云 Department of Statistics China University of Mining & Technology,Beijing May 4, 2016
  • 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 目录 1 安装 R 包 2 获取数据 3 统计绘图 4 统计计算 5 R 语言定义
  • 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 安装 R 包 从指定网站安装 R 包 install.packages("ggplot2",repos = "https://mirrors.tuna.tsinghua.edu.cn/CRAN/") install.packages("pim",repos = "http://www.r-forge.r-project.org/",lib = "D:/library/") 一行命令安装 cran 上所有的 Packages install.packages(setdiff(available.packages()[,1], .packages(all.available = TRUE))) 安装 Bioconductor 上的 R 包 source("https://bioconductor.org/biocLite.R") library(BiocInstaller) biocLite("ggtree") 安装 Github 上的 R 包 library(devtools) install_github("ropensci/aRxiv")
  • 4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 安装注意几项 依赖问题 主要针对离线安装和源码编译安装 平台问题 有些 R 包只能装在类 unix 操作系统上 软件问题 有些 R 包要求相应 R 软件版本 特定库依赖 如 gputools 包依赖 cuda 库 # OS information Sys.info() sysname release version nodename "Windows" "10 x64" "build 10586" "LENOVO-PC" machine login user effective_user "x86-64" "Xiangyun Huang" "Xiangyun Huang" "Xiangyun Huang"
  • 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 R 软件信息 > version _ platform x86_64-w64-mingw32 arch x86_64 os mingw32 system x86_64, mingw32 status major 3 minor 2.5 year 2016 month 04 day 14 svn rev 70478 language R version.string R version 3.2.5 (2016-04-14) nickname Very, Very Secure Dishes
  • 6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 目录 1 安装 R 包 2 获取数据 3 统计绘图 4 统计计算 5 R 语言定义
  • 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 R 软件系统自带的数据集 # view R data sets length(data(package = .packages(all.available = TRUE))$results[,3]) ## [1] 20969 # extended packages library(ggplot2) data("diamonds") head(diamonds) ## carat cut color clarity depth table price x y z ## 1 0.23 Ideal E SI2 61.5 55 326 3.95 3.98 2.43 ## 2 0.21 Premium E SI1 59.8 61 326 3.89 3.84 2.31 ## 3 0.23 Good E VS1 56.9 65 327 4.05 4.07 2.31 ## 4 0.29 Premium I VS2 62.4 58 334 4.20 4.23 2.63 ## 5 0.31 Good J SI2 63.3 58 335 4.34 4.35 2.75 ## 6 0.24 Very Good J VVS2 62.8 57 336 3.94 3.96 2.48
  • 8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 目录 1 安装 R 包 2 获取数据 3 统计绘图 4 统计计算 5 R 语言定义
  • 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 plot 函数–pch 点 26 shaps of points
  • 10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 plot 函数–lty–lwd 线 0 10 20 30 40 50 −1.5−1.0−0.50.00.51.01.52.0 Simple Use of Color In a Plot Just a Whisper of a Label
  • 11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 调色板–连续型 Blues BuGn BuPu GnBu Greens Greys Oranges OrRd PuBu PuBuGn PuRd Purples RdPu Reds YlGn YlGnBu YlOrBr YlOrRd
  • 12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 调色板–极端型 BrBG PiYG PRGn PuOr RdBu RdGy RdYlBu RdYlGn Spectral
  • 13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 调色板–离散型 Accent Dark2 Paired Pastel1 Pastel2 Set1 Set2 Set3
  • 14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 举个栗子 barplot(sample(seq(20),6,replace = T),col=brewer.pal(11, "BrBG")[3:8]) 05101520
  • 15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 再举个栗子 Set3 3 colors VADeaths Frequency 10 20 30 40 50 60 70 0.00.51.01.52.02.53.0 Set2 3 colors VADeaths Frequency 0 20 40 60 8002468 Set1 3 colors VADeaths Frequency 0 20 40 60 80 0123456 Set3 8 colors VADeaths Frequency 0 20 40 60 80 100 051015 Greys 8 colors VADeaths Frequency 0 20 40 60 80 0123456 Greens 8 colors VADeaths Frequency 0 20 40 60 80 0123456
  • 16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 继续举个栗子 Sepal.Length 2.0 2.5 3.0 3.5 4.0 0.5 1.0 1.5 2.0 2.5 4.55.56.57.5 2.03.04.0 Sepal.Width Petal.Length 1234567 0.51.52.5 Petal.Width 4.5 5.5 6.5 7.5 1 2 3 4 5 6 7 1.0 1.5 2.0 2.5 3.0 1.02.03.0 Species
  • 17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 三维图–persp X −10 −5 0 5 10 Y −10 −5 0 5 10 Z −2 0 2 4 6 8 . z = Sinc( x2 + y2 )
  • 18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 添加数学公式 −3 −2 −1 0 1 2 3 0.00.10.20.30.4 Normal Probability Density Function x dnorm(x) f(x) = 1 2πσ2 e −(x−µ)2 2σ2 −3 −2 −1 0 1 2 3 0.00.20.40.60.81.0 Normal Cumulative Distribution Function x cumsum(x)/sum(x) φ(x) = 1 2π ⌠ ⌡−∞ x e(−t2 2) dt
  • 19. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 anscombe 数据 4 6 8 10 12 14 4567891011 x1 y1 y1 = 3 + 0.5x1 4 6 8 10 12 14 3456789 x1 y2 y2 = 3 + 0.5x1 4 6 8 10 12 14 681012 x1 y3 y3 = 3 + 0.5x1 8 10 12 14 16 18 681012 x4 y4 y4 = 3 + 0.5x4 σ^2 = 1.531,Multiple R2 = 0.667,Adjusted R2 = 0.629
  • 20. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 barplot cardiothoracic gastrointestinal neuro other trauma Types of surgery Absolutefrequency 050100150200
  • 21. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 barplot 0 10 20 30 40 cardiothoracic gastrointestinal neuro other trauma surgery Relativefrequencyin% Types of surgery
  • 22. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 目录 1 安装 R 包 2 获取数据 3 统计绘图 4 统计计算 5 R 语言定义
  • 23. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 多元概率分布函数 The multivariate t distribution (MVT) is given by T(a, b, Σ, ν) = 21− ν 2 Γ(ν 2 ) ∫ ∞ 0 sν−1 e− s2 2 Φ( sa √ ν , sb √ ν , Σ)ds multivariate normal distribution function (MVN) Φ(a, b, Σ) = 1 √ |Σ|(2π)m ∫ b1 a1 ∫ b2 a2 · · · ∫ bm am e−1 2 x⊤Σ−1x dx x = (x1, x2, . . . , xm)⊤, −∞ ≤ ai ≤ bi ≤ ∞ for all i, and Σ is a positive semi-definite symmetric m × m matrix
  • 24. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 计算多元正态分布的概率 library(mvtnorm) library(matrixcalc) path<-"C:/Users/Xiangyun Huang/Desktop/LanguageDefinitionR/" setwd(path) sigma <- read.csv(file="data/sigma1.csv",header=F, sep=",") mat<-matrix(0,nrow = nrow(sigma),ncol = ncol(sigma)) sigma <- as.matrix(sigma) attributes(sigma)<-attributes(mat) # str(sigma) # is.symmetric.matrix(sigma) # is.positive.definite(sigma) m = nrow(sigma) Fn = pmvnorm(lower=rep(-Inf, m), upper=rep(0, m), mean=rep(0, m), sigma =sigma) Fn ## [1] 6.748008e-29 ## attr(,"error") ## [1] 2.48407e-31 ## attr(,"msg") ## [1] "Normal Completion"
  • 25. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 多元 t 分布分位数计算 n <- c(26, 24, 20, 33, 32) V <- diag(1/n); df <- 130 C <- matrix(c(1,1,1,0,0,-1,0,0,1,0, 0,-1,0,0,1,0,0,0,-1,-1, 0,0,-1,0,0),ncol=5) cv <- C %*% V %*% t(C) ## covariance matrix dv <- t(1/sqrt(diag(cv))) cr <- cv * (t(dv) %*% dv) ## correlation matrix delta <- rep(0,5) Tn<-qmvt(0.95, df = df, delta = delta, corr = cr, abseps = 0.0001,maxpts = 100000, tail = "both") Tn ## $quantile ## [1] 2.560946 ## ## $f.quantile ## [1] 1.523691e-07 ## ## attr(,"message") ## [1] "Normal Completion"
  • 26. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 目录 1 安装 R 包 2 获取数据 3 统计绘图 4 统计计算 5 R 语言定义
  • 27. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 谈谈对象 class(sigma) #Object Classes ## [1] "matrix" str(sigma) #Compactly Display the Structure of an Arbitrary R Object ## num [1:83, 1:83] 0.3806 -0.0104 0 0 0 ... mode(sigma) #The (Storage) Mode of an Object ## [1] "numeric" typeof(sigma) #The Type of an Object ## [1] "double" attributes(sigma) #Object Attribute Lists ## $dim ## [1] 83 83
  • 28. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 pryr 包撬开 R 的底层 pryr: Useful tools to pry back the covers of R and understand the language at a deeper level. c(is.list(sigma),is.matrix(sigma)) ## [1] FALSE TRUE c(is.vector(sigma),is.numeric(sigma)) ## [1] FALSE TRUE c(is.array(sigma),is.data.frame(sigma)) ## [1] TRUE FALSE
  • 29. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 撬开 tabulate 函数 tabulate ## function (bin, nbins = max(1L, bin, na.rm = TRUE)) ## { ## if (!is.numeric(bin) && !is.factor(bin)) ## stop("'bin' must be numeric or a factor") ## if (typeof(bin) != "integer") ## bin <- as.integer(bin) ## if (nbins > .Machine$integer.max) ## stop("attempt to make a table with >= 2^31 elements") ## nbins <- as.integer(nbins) ## if (is.na(nbins)) ## stop("invalid value of 'nbins'") ## .Internal(tabulate(bin, nbins)) ## } ## <bytecode: 0x0000000016e96018> ## <environment: namespace:base>
  • 30. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 撬开 tabulate 函数 library(pryr) show_c_source(.Internal(tabulate(bin,nbins))) SEXP attribute_hidden do_tabulate(SEXP call, SEXP op, SEXP args, SEXP rho) { checkArity(op, args); SEXP in = CAR(args), nbin = CADR(args); if (TYPEOF(in) != INTSXP) error("invalid input"); R_xlen_t n = XLENGTH(in); /* FIXME: could in principle be a long vector */ int nb = asInteger(nbin); if (nb == NA_INTEGER || nb < 0) error(_("invalid '%s' argument"), "nbin"); SEXP ans = allocVector(INTSXP, nb); int *x = INTEGER(in), *y = INTEGER(ans); if (nb) memset(y, 0, nb * sizeof(int)); for(R_xlen_t i = 0 ; i < n ; i++) if (x[i] != NA_INTEGER && x[i] > 0 && x[i] <= nb) y[x[i] - 1]++; return ans; }
  • 31. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 撬开 plot methods(plot) ## [1] plot,ANY-method plot,color-method plot.acf* ## [4] plot.data.frame* plot.decomposed.ts* plot.default ## [7] plot.dendrogram* plot.density* plot.ecdf ## [10] plot.factor* plot.formula* plot.function ## [13] plot.ggplot* plot.gtable* plot.hclust* ## [16] plot.histogram* plot.HoltWinters* plot.isoreg* ## [19] plot.lm* plot.medpolish* plot.mlm* ## [22] plot.ppr* plot.prcomp* plot.princomp* ## [25] plot.profile.nls* plot.raster* plot.spec* ## [28] plot.stepfun plot.stl* plot.table* ## [31] plot.ts plot.tskernel* plot.TukeyHSD* ## see '?methods' for accessing help and source code
  • 32. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 visible from generic isS4 plot,ANY-method TRUE graphics plot TRUE plot,color-method TRUE colorspace plot TRUE plot.acf FALSE registered S3method for plot plot FALSE plot.data.frame FALSE registered S3method for plot plot FALSE plot.decomposed.ts FALSE registered S3method for plot plot FALSE plot.default TRUE graphics plot FALSE plot.dendrogram FALSE registered S3method for plot plot FALSE plot.density FALSE registered S3method for plot plot FALSE plot.ecdf TRUE stats plot FALSE plot.factor FALSE registered S3method for plot plot FALSE plot.formula FALSE registered S3method for plot plot FALSE plot.function TRUE graphics plot FALSE plot.ggplot FALSE registered S3method for plot plot FALSE plot.gtable FALSE registered S3method for plot plot FALSE plot.hclust FALSE registered S3method for plot plot FALSE plot.histogram FALSE registered S3method for plot plot FALSE plot.HoltWinters FALSE registered S3method for plot plot FALSE plot.isoreg FALSE registered S3method for plot plot FALSE plot.lm FALSE registered S3method for plot plot FALSE plot.medpolish FALSE registered S3method for plot plot FALSE plot.mlm FALSE registered S3method for plot plot FALSE plot.ppr FALSE registered S3method for plot plot FALSE plot.prcomp FALSE registered S3method for plot plot FALSE plot.princomp FALSE registered S3method for plot plot FALSE plot.profile.nls FALSE registered S3method for plot plot FALSE plot.raster FALSE registered S3method for plot plot FALSE plot.spec FALSE registered S3method for plot plot FALSE plot.stepfun TRUE stats plot FALSE plot.stl FALSE registered S3method for plot plot FALSE plot.table FALSE registered S3method for plot plot FALSE plot.ts TRUE stats plot FALSE plot.tskernel FALSE registered S3method for plot plot FALSE plot.TukeyHSD FALSE registered S3method for plot plot FALSE
  • 33. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 安装 R 包 获取数据 统计绘图 统计计算 R 语言定义 统计计算环境 > devtools::session_info()$packages package * version date source colorspace 1.2-6 2015-03-11 CRAN (R 3.2.4) devtools 1.11.0 2016-04-12 CRAN (R 3.2.4) digest 0.6.9 2016-01-08 CRAN (R 3.2.4) evaluate 0.9 2016-04-29 CRAN (R 3.2.5) formatR 1.3 2016-03-05 CRAN (R 3.2.4) ggplot2 * 2.1.0 2016-03-01 CRAN (R 3.2.4) gtable 0.2.0 2016-02-26 CRAN (R 3.2.4) highr 0.5.1 2015-09-18 CRAN (R 3.2.4) knitr * 1.12.27 2016-05-01 Github (yihui/knitr@5a0a689) labeling 0.3 2014-08-23 CRAN (R 3.2.3) magrittr 1.5 2014-11-22 CRAN (R 3.2.3) matrixcalc * 1.0-3 2012-09-15 CRAN (R 3.2.3) memoise 1.0.0 2016-01-29 CRAN (R 3.2.3) munsell 0.4.3 2016-02-13 CRAN (R 3.2.3) mvtnorm * 1.0-5 2016-02-02 CRAN (R 3.2.3) plyr 1.8.3 2015-06-12 CRAN (R 3.2.3) RColorBrewer * 1.1-2 2014-12-07 CRAN (R 3.2.3) Rcpp 0.12.4 2016-03-26 CRAN (R 3.2.4) scales 0.4.0 2016-02-26 CRAN (R 3.2.3) stringi 1.0-1 2015-10-22 CRAN (R 3.2.3) stringr 1.0.0 2015-04-30 CRAN (R 3.2.3) withr 1.0.1 2016-02-04 CRAN (R 3.2.3)