0

Right now I have the following code for mean and sd seperated as

aggregate(renters$rentm25,
          list(Province = renters$pvreg25, Mean = renters$pvreg25), mean)

aggregate(renters$rentm25,
          list(Province = renters$pvreg25, Mean = renters$pvreg25), sd)

Data

enter image description here

I also want to know how I can change the value of x to name it as mean and sd?

steveb
  • 5,382
  • 2
  • 27
  • 36
honix
  • 11

1 Answers1

1

The doBy package doesn't get a lot of attention, but it does this job nicely:

library(doBy)
summaryBy(rentm25 ~ pvreg25, FUN=c(mean, sd), data=renters)

But since you did not provide example data, it is not clear that this is what you are looking for.

Remko Duursma
  • 2,741
  • 17
  • 24