У вас есть ошибка в вашем синтаксисе рядом с тем, где вы создаете without_first_row
, следуйте ниже:
con_promedio_por_curso_transpuesta <-
data.frame(
row.names = c('Description','mean(X7)','mean(X8)','mean(X9)','mean(X10)'),
'A' = c("Abc","5.000000","5.000000","5.000000","5.000000"),
'B' = c("Bcd","4.105263","3.736842","3.950000","4.210526"),
'C' = c("Cde","4.733333","4.400000","4.600000","4.333333"),
'D' = c("Def","4.680000","4.760000","4.840000","4.560000"),
'ID' = c(NA, 1, 1, 2, 2) # added for this example
)
## without_first_row <- con_promedio_por_curso_transpuesta[-c(1), ]) <- this is your error, you added a ')' unnecessarily
without_first_row <- con_promedio_por_curso_transpuesta[-c(1), ] # with fixed syntax
> class(without_first_row)
[1] "data.frame"
# just to show you can group_by and summarise with data
without_first_row %>%
mutate_at(.vars = vars(c(A,B,C,D)), funs(as.numeric)) %>%
group_by(ID) %>%
summarise_all(mean)