[R] Clustering

David Winsemius dwinsemius at comcast.net
Fri Oct 29 18:25:21 CEST 2010


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?
>
>>
>> $ 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- 
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



More information about the R-help mailing list