Hi
I have a problem using the package cluster on my binary data. I want to
try mona at first. But i get the an error.
hc<-read.table("all.txt", header=TRUE, sep="\t",
row.names=1)
srt(hc)
`data.frame': 51 obs. of 59 variables:
$ G1p : int 2 1 1 1 1 1 1 1 1 1 ...
$ G1q : int 1 1 1 1 1 1 1 1 1 1 ...
$ G2p : int 1 1 1 1 1 1 1 1 1 1 ...
$ G2q : int 1 1 1 1 1 1 1 1 1 1 ...
$ G3p : int 1 1 1 1 1 1 1 1 1 1 ...
m<-mona(hc)
Error in mona(hc) : All variables must be binary (factor with 2 levels).
I find this strange when the cluster dataset "animals" have the same
structure as my data.
srt(animals)
`data.frame': 20 obs. of 6 variables:
$ war: int 1 1 2 1 2 2 2 2 2 1 ...
$ fly: int 1 2 1 1 1 1 2 2 1 2 ...
$ ver: int 1 1 2 1 2 2 2 2 2 1 ...
$ end: int 1 1 1 1 2 1 1 2 2 1 ...
$ gro: int 2 2 1 1 2 2 2 1 2 1 ...
$ hai: int 1 2 2 2 2 2 1 1 1 1 ...
m<-mona(animals) #works fine
what is this error trying to tell me?
mvh
morten
On Jan 27, 2005, at 9:06 AM, Morten Mattingsdal wrote:> Hi > > I have a problem using the package cluster on my binary data. I want > to try mona at first. But i get the an error. > > hc<-read.table("all.txt", header=TRUE, sep="\t", row.names=1) > srt(hc) > `data.frame': 51 obs. of 59 variables: > $ G1p : int 2 1 1 1 1 1 1 1 1 1 ... > $ G1q : int 1 1 1 1 1 1 1 1 1 1 ... > $ G2p : int 1 1 1 1 1 1 1 1 1 1 ... > $ G2q : int 1 1 1 1 1 1 1 1 1 1 ... > $ G3p : int 1 1 1 1 1 1 1 1 1 1 ... > > m<-mona(hc) > Error in mona(hc) : All variables must be binary (factor with 2 > levels). >You have to be careful that the data are indeed each factors with 2 levels (numeric variables with values 1 and 2 will not do). A summary of the data will tell you that. Sean> I find this strange when the cluster dataset "animals" have the same > structure as my data. > > srt(animals) > `data.frame': 20 obs. of 6 variables: > $ war: int 1 1 2 1 2 2 2 2 2 1 ... > $ fly: int 1 2 1 1 1 1 2 2 1 2 ... > $ ver: int 1 1 2 1 2 2 2 2 2 1 ... > $ end: int 1 1 1 1 2 1 1 2 2 1 ... > $ gro: int 2 2 1 1 2 2 2 1 2 1 ... > $ hai: int 1 2 2 2 2 2 1 1 1 1 ... > > m<-mona(animals) #works fine > > what is this error trying to tell me? > mvh > morten > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html
Morten, just a try: is there a constant variable (only 1) in the first dataset? Christian On Thu, 27 Jan 2005, Morten Mattingsdal wrote:> Hi > > I have a problem using the package cluster on my binary data. I want to > try mona at first. But i get the an error. > > hc<-read.table("all.txt", header=TRUE, sep="\t", row.names=1) > srt(hc) > `data.frame': 51 obs. of 59 variables: > $ G1p : int 2 1 1 1 1 1 1 1 1 1 ... > $ G1q : int 1 1 1 1 1 1 1 1 1 1 ... > $ G2p : int 1 1 1 1 1 1 1 1 1 1 ... > $ G2q : int 1 1 1 1 1 1 1 1 1 1 ... > $ G3p : int 1 1 1 1 1 1 1 1 1 1 ... > > m<-mona(hc) > Error in mona(hc) : All variables must be binary (factor with 2 levels). > > I find this strange when the cluster dataset "animals" have the same > structure as my data. > > srt(animals) > `data.frame': 20 obs. of 6 variables: > $ war: int 1 1 2 1 2 2 2 2 2 1 ... > $ fly: int 1 2 1 1 1 1 2 2 1 2 ... > $ ver: int 1 1 2 1 2 2 2 2 2 1 ... > $ end: int 1 1 1 1 2 1 1 2 2 1 ... > $ gro: int 2 2 1 1 2 2 2 1 2 1 ... > $ hai: int 1 2 2 2 2 2 1 1 1 1 ... > > m<-mona(animals) #works fine > > what is this error trying to tell me? > mvh > morten > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >*********************************************************************** Christian Hennig Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg hennig at math.uni-hamburg.de, http://www.math.uni-hamburg.de/home/hennig/ ####################################################################### ich empfehle www.boag-online.de