# Group by Gender_SNB and num_SNB, and calculate summary statistics av_data1_all <- s_complete %>% group_by(Gender_SNB, num_SNB) %>% summarise(mean_num_SNB = mean(num_SNB), sum_synch = sum(synch), count = n()) %>% ungroup()
--- ### indexing in R - `(x)`: `x` is an object, in R, it is a vectore or data frame - `x[i]`: `x` is a vector, `i` is an integer, which is the index of `x` - `x[[i]]`: `x` is a data frame, `i` is an integer, which is the sequence number of `x` - `x$i`: `x` is a data frame, `i` is a string, which is the variable name - `x[i,j]`: `x` is a matrix, `i` and `j` are integers, which are the index of `x` - `x[[i,j]]`: `x` is a data frame, `i` and `j` are integers, which are the sequence number of `x` - `x$i[j]`: `x` is a data frame, `i` is a string, and `j` is an integer, which is the variable name and index - `