I'm doing some practice on broom package in R.
I ran the following
kclusts <- data.frame(k=1:9) %>% group_by(k) %>% do(fit=kmeans(data.frame, .$k))
I have received the following error
Error in as.vector(x, mode) : cannot coerce type 'closure' to vector of type 'any'
I was wondering whether I'm missing something in my string.
Hope you can help me out.
Juan
The question seemed to get solved in the comments, but I thought I would generalize it because I got a very similar error.
The reason you're getting that error can be found this way:
You're effectively passing in the function that you use to create data frames, instead of a data frame.
The vignette for broom has a way to make code like this work: