Help with "Error in Summary.factor(..., na.rm = na.rm) : "max" not meaningful for factors", please?
1
0
Entering edit mode
@fatima-nunez-300
Last seen 10.3 years ago
Hello all, At the moment I'm trying to obtain adjusted p-values using the maxT and minP functions on my data as described below, but when I try to implement any of the two I obtain the error shown. I have looked the ?Summary.factor help but I have to admit I didn't quite understand it. Could anybody please help me with this error in order to know what I'm doing wrong? >rmadata2$Genotype [1] CONT CONT CONT VAV2 VAV2 VAV2 Levels: CONT VAV2 > Index1 <- which(rmadata2$Genotype=="CONT") > Index2 <- which(rmadata2$Genotype=="VAV2") > scores <- esApply (rmadata2, 1, function(x) { + tmp <-t.test(x[Index2], x[Index1], var.equal =TRUE) + c(mean(tmp$estimate), -diff(tmp$estimate), tmp$statistic, tmp$p.value) + }) > scores <- t(scores) > colnames(scores) <- c("a", "m", "t.test", "p.value") > sum(scores[, 4] <= 0.05) [1] 1130 > sum(scores[, 4] <= 0.01) [1] 318 > tmp <- mt.rawp2adjp(scores[,4]) > adj.p.values <- tmp$adjp[order(tmp$index), -1] > scores <- cbind(scores, adj.p.values) > tmp <- mt.maxT(exprs(rmadata2), rmadata2$Genotype) Error in Summary.factor(..., na.rm = na.rm) : "max" not meaningful for factors Thanks in advance for your help and sorry if this is not a relevant question for BioC, Fatima _______ ? ? F?tima N??ez, PhD Centre for Cancer Research (CIC) University of Salamanca-CSIC Campus Unamuno 37007 Salamanca?????????????????????????????????????????????????? Spain Phone: + 34 923 294802 Fax:?????+ 34 923 294743 E-mail: fnunez@usal.es
Cancer Cancer • 7.8k views
ADD COMMENT
0
Entering edit mode
Ramon Diaz ★ 1.1k
@ramon-diaz-159
Last seen 10.3 years ago
Hola F?tima, I think the problem is that your class labels (rmadata2$Genotype) are a factor, but they should be a vector of integers starting at 0. The help for mt.maxT says: "classlabel: A vector of integers corresponding to observation (column) class labels. For k classes, the labels must be integers between 0 and k-1." You can easily achieve that by doing: my.classlabels <- as.numeric(rmadata2$Genotype) - 1 Best, Ram?n On Wednesday 02 July 2003 13:27, F?tima N??ez wrote: > Hello all, > > At the moment I'm trying to obtain adjusted p-values using the maxT and > minP functions on my data as described below, but when I try to > implement any of the two I obtain the error shown. I have looked the > ?Summary.factor help but I have to admit I didn't quite understand it. > Could anybody please help me with this error in order to know what I'm > doing wrong? > > >rmadata2$Genotype > > [1] CONT CONT CONT VAV2 VAV2 VAV2 > Levels: CONT VAV2 > > > Index1 <- which(rmadata2$Genotype=="CONT") > > Index2 <- which(rmadata2$Genotype=="VAV2") > > scores <- esApply (rmadata2, 1, function(x) { > > + tmp <-t.test(x[Index2], x[Index1], var.equal =TRUE) > + c(mean(tmp$estimate), -diff(tmp$estimate), tmp$statistic, > tmp$p.value) > + }) > > > scores <- t(scores) > > colnames(scores) <- c("a", "m", "t.test", "p.value") > > sum(scores[, 4] <= 0.05) > > [1] 1130 > > > sum(scores[, 4] <= 0.01) > > [1] 318 > > > tmp <- mt.rawp2adjp(scores[,4]) > > adj.p.values <- tmp$adjp[order(tmp$index), -1] > > scores <- cbind(scores, adj.p.values) > > tmp <- mt.maxT(exprs(rmadata2), rmadata2$Genotype) > > Error in Summary.factor(..., na.rm = na.rm) : > "max" not meaningful for factors > > Thanks in advance for your help and sorry if this is not a relevant > question for BioC, > Fatima > > _______ > > > > F?tima N??ez, PhD > Centre for Cancer Research (CIC) > University of Salamanca-CSIC > Campus Unamuno > 37007 Salamanca > Spain > Phone: + 34 923 294802 > Fax: + 34 923 294743 > E-mail: fnunez@usal.es > > _______________________________________________ > Bioconductor mailing list > Bioconductor@stat.math.ethz.ch > https://www.stat.math.ethz.ch/mailman/listinfo/bioconductor -- Ram?n D?az-Uriarte Bioinformatics Unit Centro Nacional de Investigaciones Oncol?gicas (CNIO) (Spanish National Cancer Center) Melchor Fern?ndez Almagro, 3 28029 Madrid (Spain) Fax: +-34-91-224-6972 Phone: +-34-91-224-6900 http://bioinfo.cnio.es/~rdiaz
ADD COMMENT

Login before adding your answer.

Traffic: 526 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6