问题描述
我正在使用R的kml
包对数据进行聚类,最后需要获得一个csv文件,该文件的列包含根据每个ID的聚类数.数据缺少许多值,因此我不能在不删除所有观测值的情况下使用kmeans
函数,但是kml
可以很好地工作.我的问题是我使用choice()
导出结果,而我得到的只是一个图形窗口,但是没有输出文件.这是我的代码:
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")
我该怎么办?
推荐答案
我遇到了同样的问题,并以这种方式解决了这个问题:首先,您需要使用箭头选择所需的分区其次,按空格"选择它,然后按"Enter",您可以在工作目录中找到所有文件,请检查getwd().祝你好运.
I had the same problem and I solved it that way:first, you need to choose the desired partition with the arrowsecond, select it pressing "space",then press "Enter" and you can find all files in your work directory, check getwd().Good luck.
这篇关于从R中的kml包导出结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!