If you have a Likert scale that you’ve already reverse coded as per the instructions above, you should have a dataframe with just the columns of raw scores for that scale. Using our example data, we run the following command to make a new column in that dataframe called SDO_mean_scores, where each row in the column contains the mean of all the other cells in the same row of the dataframe:
SDO$SDO_mean_scores <- rowMeans(SDO, na.rm = TRUE)
*If you get an error similar to “Error in rowMeans(SDO, na.rm = TRUE) : ‘x’ must be numeric”, run the following code on your variable dataframe, then try the mean score calculation again:
SDO <- mutate_all(SDO, function(x) as.numeric(as.character(x)))