R-studio doesn't appear to be recognizing a numerical variable

Here you are literally asking R to average two text strings, "Reference A" and "Reference B". To reference non-syntactic variable names you have to enclose them between backticks, not double-quotes. Also, the mean() function works "by column" not "by row". If you want to calculate the mean of values that come from more than one column, you need to use rowwise() and c_across() to reference the columns.
The code should look something like this

library(dplyr)

full_data <- full_data %>%
    rowwise() %>% 
    mutate(reference_avg = mean(c_across(c(`Reference A`,`Reference B`))))

If this doesn't solve your problem, please provide a proper REPRoducible EXample (reprex) illustrating your issue.

1 Like