Contact me:

摘要: x<-rnorm(3) #随机生成3个随机数 结果:1.4197419 -0.7460519 0.3603622 x<-rnorm(3) #再来一遍,生成的3个随机数又不一样了 结果:1.0796213 0.5598334 0.5344839 set.seed(123) x<-rnorm(3) #随 阅读全文
posted @ 2020-06-04 16:58 impwa 阅读(271) 评论(0) 推荐(0)
摘要: tapply(x,f,g) x向量组 f(factor)因子或因子列表 g函数 将x按f分组的到子向量组并应用函数g x <- c("男", "女", "男", "男", "女") sex <- factor(x) h <- c(165, 170, 168, 172, 159) tapply(h, 阅读全文
posted @ 2020-06-04 16:41 impwa 阅读(443) 评论(0) 推荐(0)
摘要: 两个函数实际上就是为对象创建属性 ##attributes() ###读取对象属性 x<- table(c(3,4,6,8,6)) attributes(x) $dim [1] 4 $dimnames $dimnames[[1]] [1] "3" "4" "6" "8" $class [1] "ta 阅读全文
posted @ 2020-06-04 16:30 impwa 阅读(1766) 评论(0) 推荐(0)
摘要: table() 记录数据频数 x <- table(c(1,2,1,3,2,1)); print(x) 1 2 3 3 2 1 阅读全文
posted @ 2020-06-04 12:00 impwa 阅读(204) 评论(0) 推荐(0)