亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

R語(yǔ)言中aggregate?函數(shù)詳解

 更新時(shí)間:2023年04月26日 10:04:48   作者:小鯊魚2018  
這篇文章主要介紹了R語(yǔ)言中aggregate?函數(shù)的相關(guān)資料,aggregate函數(shù)是數(shù)據(jù)處理中常用到的函數(shù),具有強(qiáng)大的功能,可以按照要求把數(shù)據(jù)打組聚合,然后對(duì)聚合以后的數(shù)據(jù)進(jìn)行加和、求平均等各種操作,需要的朋友可以參考下

R語(yǔ)言中aggregate 函數(shù)

aggregate函數(shù)是數(shù)據(jù)處理中常用到的函數(shù),具有強(qiáng)大的功能??梢园凑找蟀褦?shù)據(jù)打組聚合,然后對(duì)聚合以后的數(shù)據(jù)進(jìn)行加和、求平均等各種操作。具體說(shuō)明可使用命令:help("aggregate")獲取官方文檔。

001、測(cè)試數(shù)據(jù)框

studentID <- seq(1, 20)
gender <- rep(c("M", "M", "F", "F", "F"), 4)
math <- rep(c(92, 86, 85, 74, 82), 4)
english <- rep(c(76, 69, 82, 71, 80), 4)
class <- rep(c(paste0(c(1, 2, 2, 1),"班")), 5)
score <- data.frame(studentID, class, gender, math, english)
dim(score)
head(score

002、 調(diào)用函數(shù)

aggregate(score[,5], by=list(score$gender), mean)
aggregate(score[,5], by=list(score$gender, score$class), mean)
aggregate(score[,5], by=list(score$gender, score$class), sum)
aggregate(score[,5], by=list(score$gender, score$class), max)

到此這篇關(guān)于R語(yǔ)言中aggregate 函數(shù)詳解的文章就介紹到這了,更多相關(guān)R語(yǔ)言aggregate 函數(shù)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論