First of all, let me say this community is very helpful. As for my questions:
I have some data with likert responses 1-4 with 8 as I don't know and 9 as NA
.
I was able to replace my 8s and 9s with NAs using:
df %>% mutate_all(~ifelse(.x %in% c(8, 9), NA, .x))
and did that for each variable.
My problem now is that I have good looking data with NA
s, but I am trying to convert groups of variables into continuous scale items. For instance, ir1, ir2, and ir3, have Likert responses 1-4 to add up to ir_scale
ranging from 0 - 12. The issue is when I add them:
irscale <- df$ir1 + df$ir2 + df$ir3
Any row that had an NA
returns NA
for the sum. e.g. 1+3+NA
= NA
, I want it to return 4.
I can't turn NA
s into 0 as I am going to use regressions later. Thoughts? Here is an example data set:
https://drive.google.com/file/d/1HwtjJ-nChRwVuVQhAYucB_JkUagVtByj/view?usp=sharing
One option is
rowSums
, which can take care of theNA
withna.rm = TRUE
Or using
base R