[R] Simple Question About Exporting Back to Excel

Rui Barradas ruipbarradas at sapo.pt
Wed Sep 26 23:43:04 CEST 2012


Hello,

In the help page for ?hclust you will see the return values. It has an 
element order, "a vector giving the permutation of the original 
observations suitable for plotting".

 From the first example on that page:

hc <- hclust(dist(USArrests), "ave")
plot(hc)
ix <- hc$order
rownames(USArrests)[ix]  # This is the order you want

Then use write.csv to write a CVS file or package XLConnect, my favorite 
for anything relating to excel. If you do use it, read the vignette, it 
will make your excel life easier.
Or do the rest of the processing in R, the [much] better choice.

Hope this helps,

Rui Barradas

Em 26-09-2012 22:11, RCar escreveu:
> All,
> Relatively new R user so this is probably an easy question to answer.
> I am able to generate a cluster for my dataset using hclust() then ploting
> the data with plot().
> This results in an image with a dendrogram with my sample names along the
> bottom.  Great!
> However, I now need a way to get that sample order from the image into
> excel.
> i.e. sample 7 was on the far left, sample 19 was in position 2, sample 93
> was in position 3, etc.
> As of now the only way for me to do this is to manually type the samples
> from the image into a worksheet.
> Very time consuming as I've got a couple hundred samples and several
> different dendrograms!
> Any thoughts?
>
> Thanks so much!
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Simple-Question-About-Exporting-Back-to-Excel-tp4644296.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list