0

I am using R to manage a file that gives an overview over the books I've read.

The csv file follows the following structure:

Name    Year.Read Gender
Title 1 2019      Female
Title 2 2018      Male
Title 3 2018      Male
Title 4 2018      Male
Title 5 2018      Female
...

There are of course more titles in the full document. What I would like to represent is the change of how many titles have been read per Gender per year, i.e., I would like to produce a table that tells me how many of the titles read in 2018 were by Women, how many were by men etc.

edit:

A desired output would like something like this:

Year Woman.Number Gender.Man.Number
2019 3            4
2018 3            4
2017 1            3
  • Can you please make a reproducible example: read https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example. And, instead of describing what you want, can you provide a table which shows your desired output? – yusuzech Oct 14 '19 at 18:16
  • 2
    Are you looking for something like `data %>% group_by(Year.Read, Gender) %>% summarize(n = n())`? – mnist Oct 14 '19 at 18:49
  • 1
    Or even more succinctly: `data %>% count(Year.Read, Gender)`. ;) Do you care if you re-read books? That can be dealt with, too, but it's unclear from your current question. – GenesRus Oct 14 '19 at 23:11
  • the last solution approximates my desired output, thank you. Would it be possible to have all genders in one table, as listed in my edited original post. Thank you for everyone's help so far :) – miri queer Oct 21 '19 at 14:13

0 Answers0