簡體   English   中英

我正在使用: R x64 ,並且無法運行我的代碼,我不知道是什么問題

[英]I'm using : R x64 , and can't run my code, I don't know what the problem

我正在使用 : R x64 ,並且無法運行我的代碼,我不知道是什么問題。 嗨開發人員這是我的代碼,我有錯誤我不知道是什么問題:

ncix <- read.table("nci.csv", sep = ",", row.names = 1, header = TRUE)
nciy <- read.table("ncilabel.txt", header = FALSE)
dat2 <- t(ncix)
dim(ncix)
dim(dat2)
mat <- matrix(rep(0,64*6831),nrow = 64)
for (i in 1:64){
   mat[i,]<-c(nciy[i,], ncix[,i])
}
data <- data.frame(mat)
View(data)
data$Y <- factor(data$X1)
levels(data$Y)<-c("BREAST", "CNS", "COLON", "K562A-repro", "K562B-repro", "LEUKEMIA", "MCF7A- 
repro","MCF7D-repro","MELANOMA","NSCLC","OVARIAN", "PROSTATE", "RENAL","UNKNOWN")
data$X1<-NULL
table(data$Y)
oui <-c("BREAST", "CNS", "COLON", "LEUKEMIA", "MELANOMA", "NSCLC", "OVARIAN", "PROSTATE", "RENAL")
dat2 <- data[data$Y%in%oui,]
mat2 <- mat[data$Y%in%oui,]
res.pca =PCA(dat2, scale.unit=TRUE, quali.sup=6831, ncp=12)

這是錯誤代碼:

 res.pca =PCA(dat2, scale.unit=TRUE, quali.sup=6831, ncp=12)
 Error in PCA(dat2, scale.unit = TRUE, quali.sup = 6831, ncp = 12) : 
 The following variables are not quantitative:  X2
 The following variables are not quantitative:  X3
 The following variables are not quantitative:  X4
 The following variables are not quantitative:  X5
 The following variables are not quantitative:  X6
 The following variables are not quantitative:  X7
 The following variables are not quantitative:  X8
 The following variables are not quantitative:  X9
 The following variables are not quantitative:  X10
 The following variables are not quantitative:  X11
 The following variables are not quantitative:  X12
 The following variables are not quantitative:  X13
 The following variables are not quantitative:  X14
 The following variables are not quantitative:  X15
 The following variables are not quantitative:  X16
 The following variables are not quantitative:  X17
 The following variables are not quantitative:  X18
 The following variables are not quantitative:  X19
 The following variables are not quantitative:  X20
 The following variables are 

這是正確的代碼,非常感謝您:

ncix <- read.table("nci.csv", sep = ",",header = TRUE,row.names = 1)
nciy <- read.table("ncilabel.txt", header = FALSE)
dat2 <- t(ncix)
dim(ncix)
dim(dat2)
mat <- matrix(rep(0,64*6831),nrow = 64)
for (i in 1:64){
mat[i,]<-c(nciy[i,], ncix[,i])
 }
data <- data.frame(mat)
View(data)
data$Y <- factor(data$X1)
levels(data$Y)<-c("BREAST", "CNS", "COLON", "K562A-repro", "K562B-repro", "LEUKEMIA", 
"MCF7A-repro","MCF7D-repro","MELANOMA","NSCLC","OVARIAN", "PROSTATE", 
"RENAL","UNKNOWN")
data$X1<-NULL
table(data$Y)
oui <-c("BREAST", "CNS", "COLON", "LEUKEMIA", "MELANOMA", "NSCLC", "OVARIAN", 
"PROSTATE", "RENAL")
dat2 <- data[data$Y%in%oui,]
mat2 <- mat[data$Y%in%oui,]
class(data$X30)
help(levels)
library(FactoMineR)
View(dat2)
class(dat2$X2)
dim(dat2)[2]
dim(dat2)[2]-1
for (i in 1:6830){
dat2[,i]<-as.numeric(dat2[,i])
}
class(dat2$X2)
res.pca =PCA(dat2,scale.unit=TRUE, quali.sup=6831, ncp=12)
plot.PCA(res.pca, axes=c(1,2), cex=0.7,habillage=6831) # axes 1 and 2
plot.PCA(res.pca, axes=c(1,3), cex=0.7,habillage=6831) # axes 1 and 3
plot.PCA(res.pca, axes=c(2,3), cex=0.7,habillage=6831) # axes 2 and 3
plot.PCA(res.pca, axes=c(1,4), cex=0.7,habillage=6831) # axes 1 and 4
plot.PCA(res.pca, axes=c(1,5), cex=0.7,habillage=6831) # axes 1 and 5

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM