2.1 变量类型

n1 <- 1
n2 <- 2.2

paste("n1 = ", n1,", n1 is the ", class(n1))
## [1] "n1 =  1 , n1 is the  numeric"
paste("n2 = ", n2,", n2 is the ", class(n2))
## [1] "n2 =  2.2 , n2 is the  numeric"

2.2 数据结构

  1. 向量 (vector) \[ \begin{bmatrix} 1 & 2 & 3 & 4 \end{bmatrix} \]
v1 = c(1,2,3) 
v2 = c('a','b','c')

paste("v1 = ", v1,", v1 is the ", class(v1))
## [1] "v1 =  1 , v1 is the  numeric" "v1 =  2 , v1 is the  numeric"
## [3] "v1 =  3 , v1 is the  numeric"
paste("v2 = ", v2,", v2 is the ", class(v2))
## [1] "v2 =  a , v2 is the  character" "v2 =  b , v2 is the  character"
## [3] "v2 =  c , v2 is the  character"

若 \(x\) 服从正态分布 (normal distribution),其概率密度函数 \(f(x)\) 为: \[ f(x; \mu, \sigma) = \frac{1}{\sqrt{2\pi} \sigma} e^{\frac{-(x-\mu)^{2}}{2\sigma^{2}}} \]