I'm using a kml
package of R to cluster my data and I need to get in the end a csv file with a column including the number of clusters according to each id. The data has many missing values, so I can't use kmeans
function without deleting all observations, but kml
works nicely with that. My problem is that I use choice()
to export the results and all I get is a graphical window, but no output files. Here is my code:
setwd("/Volumes/NATASHKA/api/R files")
statadata <-read.dta("Data_wide_withdemogr_auris_for_kml_negative.dta")
mydata <- data.frame(statadata)
cldDQ <- cld(mydata)
kml(cldDQ,c(2:6),20,toPlot="none")
plotAllCriterion(cldDQ)
par(mar = rep(2, 4))
X11(type = "Xlib")
choice(cldDQ, typeGraph = "bmp")
What do I do wrong?
I had the same problem and I solved it that way: first, you need to choose the desired partition with the arrow second, select it pressing “space”, then press “Enter” and you can find all files in your work directory, check getwd(). Good luck.
来源:https://stackoverflow.com/questions/16895162/exporting-result-from-kml-package-in-r