Conditional Summary

Hi,

I am very new to R. I have a dataset of Sex(0,1) and Age (20-99) with 1000 data point. How can I calculate Average age for Sex 0, (female)?

Also range and sd.

library(tidyverse)

(result <- group_by(
            mydataset,
            Sex ) %>% 
    summarise(across(
                .cols  = Age,
                .fns = mean))
  )

As a beginner to R you may benefit from studying this useful book.
https://r4ds.had.co.nz/
Particularly chapter 5

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.