>>>>> "Renald" == Renald Buter <[EMAIL PROTECTED]>
>>>>>     on Thu, 15 Jan 2004 12:22:18 +0100 writes:

  <....>

    Renald> Thank you *very* much for your help. I thought I'd let the list know
    Renald> what I did to get it right:

    >> # create a seed vector
    >> seed<-rank(runif(75))

S has a function for this :
     seed <- sample(75)

     ## (and "seed" is not very sensical name here)

    >> train<-ruspini[seed[1:60],]
    >> test<-ruspini[seed[61:75],]
    >> pamx<-pam(train,4)
    >> knnx<-knn(pamx$medoids,test,factor(c("a","b","c","d")),k=1)

Note on style:

  Using " " (space) in S statements is very much recommended for
  readability, particularly
  space around "<-", i.e. " <- " 
         (and this is provided with one key stroke by ESS and R-WinEdt)

Martin Maechler <[EMAIL PROTECTED]>     http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16    Leonhardstr. 27
ETH (Federal Inst. Technology)  8092 Zurich     SWITZERLAND
phone: x-41-1-632-3408          fax: ...-1228                   <><

______________________________________________
[EMAIL PROTECTED] 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

Reply via email to