That is not a data file (on disk), is a data frame (on memory)
Again, it's a data frame not a table (graphic representation) so this is not possible in this format, you would have to create a table.
ends_with() only takes one argument, but you can use matches() to specify a regex that match both options at the same time.
library(dplyr)
response.data <- data.frame(
A_len = c(20, 0, 10, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0),
C_len = c(0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1),
A_wcount = c(3, 0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1),
C_wcount = c(0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1),
URN = as.factor(c("aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg",
"hhh", "iii", "jjj", "kkk", "lll", "mmm", "nnn",
"ooo", "ppp")),
Gender = as.factor(c("Male", "Male", "Male", "Male", "Male", "Male",
"Female", "Female", "Female", "Female", "Female",
"Female", "Male", "Male", "Male", "Male"))
)
response.data %>%
select(Gender, matches("(len|count)$")) %>%
group_by(Gender) %>%
summarise_all(list(Aver = mean, Sum = sum, Count = ~n()))
#> # A tibble: 2 x 13
#> Gender A_len_Aver C_len_Aver A_wcount_Aver C_wcount_Aver A_len_Sum
#> <fct> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 Female 0.167 0.167 0 0.167 1
#> 2 Male 3.2 0.4 0.9 0.4 32
#> # … with 7 more variables: C_len_Sum <dbl>, A_wcount_Sum <dbl>,
#> # C_wcount_Sum <dbl>, A_len_Count <int>, C_len_Count <int>,
#> # A_wcount_Count <int>, C_wcount_Count <int>
Created on 2019-11-12 by the reprex package (v0.3.0.9000)