nrow(filter(dataframe, fracture_type_1 == 1)) +
nrow(filter(dataframe, fracture_type_2 == 1)) +
nrow(filter(dataframe, fracture_type_3 == 1)) +
nrow(filter(dataframe, fracture_type_4 == 1)) +
nrow(filter(dataframe, fracture_type_5 == 1))
I want to make :
nrow(filter_at(dataframe, vars(starts_with("fracture_type_")), any_vars(.==1)))
but they dont give the same outcome
If you want an output which is similar to your first attempt it would be :
library(dplyr)
dataframe %>%
summarise(total = sum(select(., starts_with("fracture_type_")) == 1))