How to aggregate data in R?

Description

To aggregate the data using R programming.

Aggregate :

  Aggregate is a unction used toaggregate the inputted data frame byone or more variable

   R Function : aggregate()

#Aggregate
#Input
attach(mtcars)
input<-mtcars

#Aggregate Function
output<-aggregate(input, by=list(vs), FUN =mean)
View(output)

#by cyl and vs
output_1<-aggregate(input,by=list(cyl,vs), FUN=median)
View(output_1)

Leave Comment

Your email address will not be published. Required fields are marked *

clear formSubmit