Can anyone see what I'm doing wrong here (highlighted below)? This is
driving me crazy... probably a ')' or something equally moronic...
> genw1[,1]
A00002 A00003 A00005 A00007 A00009 A00010 A00012 A00013 A00014 A00015 A00017
A00018 A00019 A00021 A00023 A00024
CC CC CC CC CC CC CC CC CC CC CC
CC CC CC CC CC
Etc...this is a rather large vector
> table(genw1[,1])
?? CC CG
25 10632 1
> genw2<-mat.or.vec(nrow(genw1),ncol(genw1))
> rownames(genw2)<-rownames(genw1)
> colnames(genw2)<-colnames(genw1)
> genw2[,1]<-replace(genw1[,1],which(genw1[,1]=="CC"),
"HC")
Warning message:
In `[<-.factor`(`*tmp*`, list, value = "HC") :
invalid factor level, NAs generated
Just for error checking (this is working properly):> which(genw1[,1]=="CC")
[1] 1 2 3 4 5 6 7 8 9 10 11 12
13 14 15 16 17 18
[19] 19 20 21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36
Etc...
And it works here...
> x<-matrix(c('CC', 'CC', '??',
'CG'),nrow=2 )
> x
[,1] [,2]
[1,] "CC" "??"
[2,] "CC" "CG"
> x2<-mat.or.vec(nrow(x), ncol(x))
> x2[,1]<-replace(x[,1],which(x[,1]=="CC"), "HC")
> x2
[,1] [,2]
[1,] "HC" "0"
[2,] "HC" "0"
[[alternative HTML version deleted]]