Amazing technological breakthrough possible @S-Logix pro@slogix.in

Office Address

  • 2nd Floor, #7a, High School Road, Secretariat Colony Ambattur, Chennai-600053 (Landmark: SRM School) Tamil Nadu, India
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to aggregate data in R?

Description

To aggregate the data using R programming.

Process

Aggregate :

  Aggregate is a unction used to aggregate the inputted data frame by one or more variable

   R Function : aggregate()

Sapmle Code

#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)

Screenshots
Aggregate data in R
Aggregate Function