I have a csv file containings a matrix:
version getSize() length() ... power
0 23000 23421 0.8
0 .. .. ..
1 .. .. ..
1 .. .. ..
I want to aggregate by similar versions applying the mean function to the columns. The columns are too many to write them. I need a way to specify all these columns.
Thanks in advance
You can use aggregate
. If your data.frame is called df
, try:
newdf <- aggregate(. ~ version, data = df, mean)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.