I have a huge dataset like the one provided in the example below:
data = data.frame(cong_mode = rep(c('cong', 'incong'), 2),
presentation_mode = rep(c('vocal', 'written'), 2),
sentence = c('the moon is dark', 'the Taurus is second mad',
'White is a colour', 'cooking is dull'),
unimodal = c('1', '0', '1', '1'))
Due to the fact that it is bigger than the one here provided it is not easy to find out how many observations (counting) assume either 1 or 0 into the unimodal column, which should have the same number of 1 and 0 (thus, two observations per each value).
I have used the two chunks below to resume which sentence has the incorrect observation of a unimodal sentence
dt <- data %>%
select(cong_mode, presentation_mode, sentence, unimodal) %>%
group_by(cong_mode, presentation_mode, unimodal) %>%
summarise(n = n()) %>%
arrange(unimodal)
sel = data %>%
select(cong_mode, presentation_mode, sentence, unimodal) %>%
filter(cong_mode == 'cong' & presentation_mode == 'vocal' & unimodal == 1)
Could you please provide any examples to execute all these operations in one shot?
If you please you might provide some examples with any iterative functions or with dplyr code.