[R] help with file

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Mar 18 14:14:21 CET 2004


MARGARET GALIETTI wrote:

> Hi,
> 
> I am new at R, and I need some help with some basic stuff.
> 
> I want to do clustering of data. It works perfectly, but now I want to 
> export my file form R to my Linux directory. The problem is that the file 
> is generated only with the cluster numbers, but it does not carry over the 
> identifiers. Let me show you what I did :
> 
> 1. demo<-read.table("my_table", sep=",", header=TRUE)          # I 
> imported my table into R as a data frame. I had header and one of my 
> columns was called KEYS; this was the unique identifier for my data.
> 2. #clustering part
>     >names(demo) 
>     >dm<-dist(demo[,c(3,4,5)])  
>     >names(dm)<-demo[,2]                #the unique Id called KEYS is in 
> my column number 2
>     >cluster<-hclust(dm)
>     >plot(cluster)                                    #my data is 
> displayed in dendogram
> 
> 3. Now I want to see the breakdowns; I want to see every unique KEYS and 
> corresponding cluster number
>  
>     >result<-cutree(cluster, h =1)
>    >result                                   #I can see KEYS and 
> corresponding cluster numbers
> 
> 4. Now I want to export this info out of R into a file
>     How do I do this??? I am going CRAZY. All I get is the cluster numbers 
> but not the KEYS.
> 
> HELP!!!
> 
> Margaret
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


See ?write.table.
Or ?sink for redirecting R's output, and ?dump for saving R objects ....

Uwe Ligges




More information about the R-help mailing list