[R] imput data in cclust

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Aug 6 10:20:22 CEST 2004


Please read the help on the function (in package cclust, not mentioned by 
you).  It contains two examples, and

       x: Data matrix where columns correspond to variables and rows to
          observations

Your first attempt is a vector and your second is a data frame.  cclust 
requires a *matrix*, so please give it one.

On Fri, 6 Aug 2004, Fabrice Armougom wrote:

> 
> 
> I would like to see an example of a data matrix for cclust and how to
> import it to cclust.
> In fact, i don't know how to give my imput for cclust program!
> 
> i test this file 
> 
> 1 0.23 1.52
> 2 0.52 1.25
> 3 0.13 1.89
> 4 0.78 1.11
> 
> i do  
> >library(cclust)
> >x<-scan("test.matrice.phyl")
> >cclust(x,2,method="kmeans")
> 
> i have this error message:
> 
> Error in sample(length(x), size, replace, prob) :
>         invalid first argument
> 
> 
> Now if i do :
> >library(cclust)
> >x<-read.table("test.matrice.phyl")
> >cclust(x,2,method="kmeans")
> 
> i've this error message :
> Error in as.double.default(x) : (list) object cannot be coerced to
> double

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list