I have a large dataset and super new to R. I am trying to sum across each row for columns 226-245 (These are not the names for the columns, just positions that the columns are in).
Some of my rows contain a few NA values, but I still want to calculate the numbers around those NA values, so that I don't get any NA's in the output. (So even if a row contains NA values in its columns, I want to calculate the values that aren't NA in the row so that I dont get NA as an output). Here is what I have so far, but it is still returning NA values in my sum row. For example, If the values across my row are : 1, 2, NA, 3. I still want to get a value of 6 in my output, but I am getting NA's.
CONFUSION$row_sum = rowSums(CONFUSION[,c(226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,na.rm=TRUE)])