How to aggregate data in R?

Description

To aggregate the data using R programming.

Aggregate :

  • Aggregate is a unction used to
    aggregate the inputted data frame by
    one 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