Okay, so this is the code for an example dataframe and the mean calculation, that did not work. Only problem now, I also get additional error messages about the type of data. What could be wrong about the data.frame now?
subset_ssco <- data.frame(
s1abc = c(1, 2, 3, 4, 5, 6, 7),
s1cde = c(3, 2, NA, 1, 1, NA, 4),
s1efg = c(10, 5, 2, NA, 3, 5, 3)
)
subset_ssco %>% mutate(
ssco_meanall = rowMeans(
select(
s1abc, s1cde, s1efg,
na.rm=TRUE)))
Error in mutate():
! Problem while computing ssco_meanall = rowMeans(select(s1abc, s1cde, s1efg, na.rm = TRUE)).
Caused by error in UseMethod():
! no applicable method for 'select' applied to an object of class "c('double', 'numeric')"
Backtrace:
- subset_ssco %>% ...
- dplyr::select(s1abc, s1cde, s1efg, na.rm = TRUE)
Error in mutate(., ssco_meanall = rowMeans(select(s1abc, s1cde, s1efg, :
Caused by error in UseMethod():
! no applicable method for 'select' applied to an object of class "c('double', 'numeric')"