I noticed that naImpute() fails (R 3.3.2, x86_64-apple-darwin13.4.0 (64-bit)) at rbind():
debugging in: naImpute(expmat.prip.ez, listModelGenes("RF"))
debug: {
m <- rowMeans(Exp, na.rm = T)
mm <- mean(m, na.rm = T)
m[which(is.na(m))] <- mm
mna <- rowMeans(Exp)
w <- which(is.na(mna))
for (i in w) {
try(Exp[i, which(is.na(Exp[i, ]))] <- m[i])
}
G <- setdiff(G, rownames(Exp))
if (!is.null(G)) {
tmp <- as.data.frame(array(mm, dim = c(length(G), ncol(Exp))))
rownames(tmp) <- G
names(tmp) <- names(Exp)
Exp <- rbind(Exp, tmp)
}
Exp
}
Browse[2]> q()
Warning message:
In q() : cannot quit from browser
Browse[2]> Q
naImpute(expmat.prip.ez, listModelGenes("RF"))
debugging in: naImpute(expmat.prip.ez, listModelGenes("RF"))
debug: {
m <- rowMeans(Exp, na.rm = T)
mm <- mean(m, na.rm = T)
m[which(is.na(m))] <- mm
mna <- rowMeans(Exp)
w <- which(is.na(mna))
for (i in w) {
try(Exp[i, which(is.na(Exp[i, ]))] <- m[i])
}
G <- setdiff(G, rownames(Exp))
if (!is.null(G)) {
tmp <- as.data.frame(array(mm, dim = c(length(G), ncol(Exp))))
rownames(tmp) <- G
names(tmp) <- names(Exp)
Exp <- rbind(Exp, tmp)
}
Exp
}
Browse[2]> n
debug: m <- rowMeans(Exp, na.rm = T)
Browse[2]> n
debug: mm <- mean(m, na.rm = T)
Browse[2]> n
debug: m[which(is.na(m))] <- mm
Browse[2]> n
debug: mna <- rowMeans(Exp)
Browse[2]> n
debug: w <- which(is.na(mna))
Browse[2]> n
debug: for (i in w) {
try(Exp[i, which(is.na(Exp[i, ]))] <- m[i])
}
Browse[2]> n
debug: G <- setdiff(G, rownames(Exp))
Browse[2]> n
debug: if (!is.null(G)) {
tmp <- as.data.frame(array(mm, dim = c(length(G), ncol(Exp))))
rownames(tmp) <- G
names(tmp) <- names(Exp)
Exp <- rbind(Exp, tmp)
}
Browse[2]> n
debug: tmp <- as.data.frame(array(mm, dim = c(length(G), ncol(Exp))))
Browse[2]> n
debug: rownames(tmp) <- G
Browse[2]> n
debug: names(tmp) <- names(Exp)
Browse[2]> n
debug: Exp <- rbind(Exp, tmp)
Browse[2]> n
Error in match.names(clabs, names(xi)) :
names do not match previous names`
This can be rectified by replacing
names(tmp) <- names(Exp)
with
colnames(tmp) <- colnames(Exp).
Hello,
I noticed that naImpute() fails (R 3.3.2, x86_64-apple-darwin13.4.0 (64-bit)) at rbind():
This can be rectified by replacing
names(tmp) <- names(Exp)
withcolnames(tmp) <- colnames(Exp)
.