[R] Clustering

dpender d.pender at civil.gla.ac.uk
Sat Oct 30 13:49:47 CEST 2010



David Winsemius wrote:
> 
> 
> On Oct 29, 2010, at 12:08 PM, David Winsemius wrote:
> 
>>
>> On Oct 29, 2010, at 11:37 AM, dpender wrote:
>>
>>> Apologies for being vague,
>>>
>>> The structure of the output is as follows:
>>
>> Still no code?
>>
> 
> I am using the Clusters function from the evd package
> 
>>>
>>> $ cluster1  : Named num [1:131] 3.05 2.71 3.26 2.91 2.88 3.11 3.21  
>>> -1 2.97
>>> 3.39 ...
>>> ..- attr(*, "names")= chr [1:131] "6667" "6668" "6669" "6670" ...
>>>
>>> With 613 clusters.  What I require is abstracting the first and  
>>> last value
>>> of
>>>
>>> - attr(*, "names")= chr [1:131] "6667" "6668" "6669" "6670"
>>
>> Those values are in an attribute:
> 
> Corrections:
>>
>> ? attribute
> 
> ?attributes
> 
>> ? attr
>>
>> Your specific request may (perhaps) be addressed by something like:
>>
>> attrnames <- attr(objname["cluster1"], "names")
>                             ^          ^   should be doubled square- 
> 
> This works to abstract the part that I am looking for but in order to loop
> this over every cluster I need an output object of the same form as
> clusters to write the names to.
> 
> brackets
>> attrnames[c(1, length(attrnames)]
>                                   ^  missing right-paren
> 
> Might work:
> attrnames <- attr(clusobj[["cluster1"]], "names")
> attrnames[c(1, length(attrnames))]
> --
> 
> David Winsemius, MD
> West Hartford, CT
> 
> ______________________________________________
> 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.
> 
> 


Additionally I can get the output as a matrix in form

 atomic [1:613] 3.01 4.1 3.04 3.81 3.55 3.37 3.09 4.1 3.61 6.36 ...
 - attr(*, "acs")= num 47.6

where "acs" is the average size.  Each height value in the vector has a
corresponding number relating to the location in the dataset.  When I change
the vector to matrix this looks like the row name but it isn't as
rownames(clusters) yields NULL.  

Do you have any idea how to abstract these values?

Doug
-- 
View this message in context: http://r.789695.n4.nabble.com/Clustering-tp3017056p3020216.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list