I am presented with an error message when trying to knit an Rmd script. I have tried to drop any NA's from the data being used for lines 363-364 but this did not work. It is annoying because the k-means has been run and I have been able to plot using some simple code, but for some reason it won't knit. This was the original code that worked:
KM <- kmeans(reduced_data_numeric, 5)
Here is the Code I am trying to use in order for it to knit:
KM <- kmeans(na.omit(reduced_data_numeric, 5))
Here is the message shown in 'output' section when trying to render the HTML knit:
Quitting from lines 363-364 (Movies-Analysis.Rmd)
Error in kmeans(na.omit(reduced_data_numeric, 5)) :
'centers' must be a number or a matrix
Calls: <Anonymous> ... withVisible -> eval_with_user_handlers -> eval -> eval -> kmeans
You've included the number of centers as an argument for na.omit
rather than kmeans
.
Note where the parenthesis are at the end of this line and where the 5 is:
KM <- kmeans(na.omit(reduced_data_numeric), 5)