Error occured in designing a matrix
0
0
Entering edit mode
3.1 years ago
rishav513 ▴ 30
> design <- matrix(data=0,nrow=ncol(gene expression data), ncol=2)
> rownames(design) <- colnames(gene expression data)
> colnames(design) <- c("Carcinoma","Normal")
> cSamples <- rownames(phenodata)[grep("Tumor",phenodata$Condition)]
> nSamples <- rownames(phenodata)[grep("Non_neoplastic",phenodata$Condition)]
> design[cSamples,"Carcinoma"] <- 1

**Error in `[<-`(`*tmp*`, cSamples, "Carcinoma", value = 1) : 
  subscript out of bounds**

This is my phenodata

Sample_id Condition Patient Batch

P105A Non_neoplastic P105 A

P105D Tumor P105 A

P106A Non_neoplastic P106 B

P106D Tumor P106 B

P112A Non_neoplastic P112 C

P112D Tumor P112 C

P131A Non_neoplastic P131 D

P131D Tumor P131 D

P138A Non_neoplastic P138 E

P138D Tumor P138 E

P140A Non_neoplastic P140 F

P140D Tumor P140 F

P152A Non_neoplastic P152 G

P152D Tumor P152 G

P157A Non_neoplastic P157 H

P157D Tumor P157 H

P158A Non_neoplastic P158 I

P158D Tumor P158 I

P161A Non_neoplastic P161 J

P161D Tumor P161 J

P16A Non_neoplastic P16 K

P16D Tumor P16 K

P170A Non_neoplastic P170 L

P170D Tumor P170 L

P171A Non_neoplastic P171 M

P171D Tumor P171 M

P176A Non_neoplastic P176 N

P176D Tumor P176 N

P179A Non_neoplastic P179 O

P179D Tumor P179 O

P49A Non_neoplastic P49 P

P49D Tumor P49 P

P62A Non_neoplastic P62 Q

P62D Tumor P62 Q

P6A Non_neoplastic P6 R

P6D Tumor P6 R

P75A Non neoplastic P75 S

P75D Tumor P75 S

P94A Non_neoplastic P94 T

P94D Tumor P94 T

P99A Non_neoplastic P99 U

P99D Tumor P99 U

R • 691 views
ADD COMMENT
0
Entering edit mode

Cross-posted to Bioconductor https://support.bioconductor.org/p/9135570/

ADD REPLY
0
Entering edit mode

Have you tried trouble shooting? Check the dimensions of all the things you're creating. i.e. length(cSamples), etc. Also, is this: "ncol(gene expression data)" a shorthand? If not, that line should fail because you can't give multiple arguments separated by a space in that function.

ADD REPLY
0
Entering edit mode

There is no space between gene expression data, it is like this "geneexpressiondata"

ADD REPLY

Login before adding your answer.

Traffic: 1512 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