本文介绍了从R中的kml包导出结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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包导出结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 00:44
查看更多