Count occurrences of value in a set of variables in R (per row)
问题 Let's say I have a data frame with 10 numeric variables V1-V10 (columns) and multiple rows (cases). What I would like R to do is: For each case, give me the number of occurrences of a certain value in a set of variables. For example the number of occurrences of the numeric value 99 in that single row for V2, V3, V6, which obviously has a minimum of 0 (none of the three have the value 99) and a maximum of 3 (all of the three have the value 99). I am really looking for an equivalent to the SPSS