0

I am very new to R. I am using the package MASS and in that, the dataset 'cats.' I am trying to seggregate the data into male and female cats then obtain the summary statistics of the data on each sex.

1 Answers1

0

You could use the aggregate function if you have custom queries you need to perform!

> library(MASS)
> data()
> aggregate(cbind(Bwt, Hwt)~Sex,FUN=mean, data=cats)

  Sex      Bwt       Hwt
1   F 2.359574  9.202128
2   M 2.900000 11.322680
Myles Baker
  • 3,600
  • 2
  • 19
  • 25