I have the raw file of survey data where I want to determine mean of certain columns based on identified demographic information provided in another column. For example, in-state residents are either 1 or 0 where 1 is in-state and 0 is out-of-state.
I want to pull the mean of a response for all those who's resident column is 1.
I tried grepl(1, rownames(resident)) but I believe grepl must only work on string values.