[R] Clustering

David Winsemius dwinsemius at comcast.net
Fri Oct 29 18:08:16 CEST 2010


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:

? attribute
? attr

Your specific request may (perhaps) be addressed by something like:

attrnames <- attr(objname["cluster1"], "names")
attrnames[c(1, length(attrnames)]

I don't really think this is optimal. For one thing it won't  
generalize to the rest of the clusters. Generally when data are put  
into an attribute, the programmer also provides an extraction  
function. Since Nabble posters are prone to not retaining thread  
context, the name of your function and package are probably elsewhere  
further up the thread but not available as I read this on a mail- 
client. Perhaps if you read more of the documentation? (Just a guess.)

>
> This will give a start and end point of the cluster and allow for the
> spacing to be determined.

Those would be character values and, if you want to do calculations,  
would obviously need to be coerced to numeric.

>
> Thanks,
>
> Doug
> -- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list