Output from 'choice' in R's kml

2019-05-31 22:43发布

问题:

I'm having trouble getting 'choice' to create output. When the graphical interface launches, I am selecting a partition with the space bar. This creates a black circle around the partition, indicating it has been selected. When I click 'return', nothing happens.

I checked my working directory to look for the output files, but they are not there. I used getwd() to ensure that I have the correct setwd(). No dice.

There was a similar question posted: Exporting result from kml package in R; however, the answer does not work for me.

Any suggestions? I am using R 3.1.0 GUI Mavericks build(6734) and XQuartz 2.7.6. Thanks for any help getting this working.

Here is my code:

setwd("/Users/eightfrench")

mydata <- read.csv("hcris_long3.csv")

cldHCRIS <- clusterLongData(traj=mydata)

kml(cldHCRIS,nbClusters=2:4,nbRedrawing=2,toPlot="both")

X11(type="Xlib")

choice(cldHCRIS, typeGraph= "bmp")

回答1:

The new version of kml (2.3) fix that, it provide a key to export data with linux as well (not "return" since getGraphicsEvent does not accept "return" using linux, so I have to map another key : 'm')

Christophe



回答2:

I had the same problem when using RStudio and i solved it just opening the x11 device with no specification. Like this:

setwd("/Users/eightfrench")

mydata <- read.csv("hcris_long3.csv")

cldHCRIS <- clusterLongData(traj=mydata)

kml(cldHCRIS,nbClusters=2:4,nbRedrawing=2,toPlot="both")

X11()

choice(cldHCRIS, typeGraph= "bmp")

Hope this also works for you.