Hello, can anybody tell me a easy way to change the mode of an "aggregate list" to "numeric"? I found a solution but I looks cruel. Thank's Felix PS: In the past you have asked what I am doing. I have to evaluate measures of two gauges of our university. The aim is to get an answer which one is better.> mode(MEAN)[1] "list"> mode(MEASURE)[1] "numeric" MEAN <- aggregate(INPUT[,3], by=list(INPUT[,2],INPUT[,1]), FUN=mean) MODE <- matrix(c(MEAN[,2],MEAN[,1],MEAN[,3]), ncol=3, byrow=FALSE ) x <- MODE[,1] -1 y <- (MODE[,2] -1) / 10 MEASURE <- matrix(c(MODE[,2],MODE[,1],MODE[,3]), ncol=3, byrow=FALSE )
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: https://stat.ethz.ch/pipermail/r-help/attachments/20070420/6e4cb015/attachment.pl
Hello, unfortunately storage.mode won't run.>storage.mode(MEAN) = "numeric"Default in as.double.default(list(Group.1 = c(1, 2, 3, 4, 5, 6, 7, 8, 9, : (list) Object can't change in 'double' I also tried: MEASURE <- sapply( MEAN, as.numeric ) But then, the first colum is +1 greater and the second colum is +1)*10 greater. Maybe somebody has a idea. Felix> Hello, > > I dont know if it works, but try: storage.mode(xxx) = "numeric" > > Alin > > 2007/4/20, Felix Wave <felix-wave at vr-web.de>: > > > > Hello, > > can anybody tell me a easy way to change the mode of an "aggregate list" > > to "numeric"? > > I found a solution but I looks cruel. > > > > Thank's > > Felix > > > > PS: In the past you have asked what I am doing. I have to evaluate > > measures of two > > gauges of our university. The aim is to get an answer which one is better. > > > > > > > > > mode(MEAN) > > [1] "list" > > > mode(MEASURE) > > [1] "numeric" > > > > > > MEAN <- aggregate(INPUT[,3], by=list(INPUT[,2],INPUT[,1]), FUN=mean) > > > > MODE <- matrix(c(MEAN[,2],MEAN[,1],MEAN[,3]), ncol=3, byrow=FALSE ) > > x <- MODE[,1] -1 > > y <- (MODE[,2] -1) / 10 > > > > MEASURE <- matrix(c(MODE[,2],MODE[,1],MODE[,3]), ncol=3, byrow=FALSE ) > > > > ______________________________________________ > > 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 > > and provide commented, minimal, self-contained, reproducible code. > >
With>as.matrix(MEAN[unlist(lapply(MEAN, is.numeric))])I will get two colums not three and only the last colum are my values (MEAN[,3]). The first is only a rising number. I also tried:>MEASURE <- sapply( MEAN, as.numeric )resp.>MEAN <- unlist(MEAN) >MEASURE <- matrix(MEAN, ncol=3, byrow=FALSE)But then, the first colum is +1 greater and the second colum is +1)*10 greater. Felix With this
With>as.matrix(MEAN[unlist(lapply(MEAN, is.numeric))])I will get two colums not three and only the last colum are my values (MEAN[,3]). The first is only a rising number. I also tried:>MEASURE <- sapply( MEAN, as.numeric )resp.>MEAN <- unlist(MEAN) >MEASURE <- matrix(MEAN, ncol=3, byrow=FALSE)But then, the first colum is +1 greater and the second colum is +1)*10 greater. Felix With this