- Hands-On Data Science with R
- Vitor Bianchi Lanzetta Nataraj Dasgupta Ricardo Anjoleto Farias
- 72字
- 2021-06-10 19:12:35
Aggregation functions
If, say, we were interested in finding the aggregate values of each Region of the US, we could use aggregate to find the cumulative values on a per region basis. To find the min, max, and mean of each column aggregated by region, we will first add the region value to our DataFrame:
# aggregate state$Region <- state.region ncol(state) aggregate(state[,-c(9,10)], by=list(state$Region), mean, na.rm = T)
Following is the output:
推薦閱讀
- 大數(shù)據(jù)技術(shù)與應(yīng)用基礎(chǔ)
- Project 2007項(xiàng)目管理實(shí)用詳解
- 軟件架構(gòu)設(shè)計
- Effective DevOps with AWS
- Python Data Science Essentials
- 最簡數(shù)據(jù)挖掘
- 21天學(xué)通ASP.NET
- 精通特征工程
- 單片機(jī)C語言應(yīng)用100例
- 網(wǎng)站入侵與腳本攻防修煉
- Applied Data Visualization with R and ggplot2
- Effective Business Intelligence with QuickSight
- 玩轉(zhuǎn)PowerPoint
- 商業(yè)周刊/中文版·天地?zé)o人:無人技術(shù)專刊(商業(yè)周刊/中文版)
- 精通LabVIEW 8.x