>Why does the assignment of a 3178x93 object to >another 3178x93 object remove the dimension attribute?>> GT <- array(dim = c(6,nrow(InData),ncol(InSNPs)))>> dim(GT)>[1] 6 3178 93>> SNP1 <- InSNPs[InData[,"C1"],]>> dim(SNP1)>[1] 3178 93>> SNP2 <- InSNPs[InData[,"C2"],]>> dim(SNP2)>[1] 3178 93>> dim(pmin(SNP1,SNP2))>[1] 3178 93>> GT[1,,] <- pmin(SNP1,SNP2)>> dim(GT)>NULL # why??????????????????????????????????????>> GT[2,,] <- pmax(SNP1,SNP2)>Error in GT[2, , ] <- pmax(SNP1, SNP2) : incorrect number of .subscripts
---------------------------------------------------
My understanding is that an array is just a list with a dimension attribute, so first note that loosing the dim attribute is not a great loss. It does not represent an inefficiency.
But consider this code:
> GT <- array(dim = c(6,3178, 93) )> dim(GT)[1] 6 3178 93> > > SNP1 <-as.array(matrix(0,nrow=3178,ncol=93))> dim(SNP1)[1] 3178 93> > > > GT[1,,] <- SNP1> dim(GT)[1] 6 3178 93
Here what you wanted to happen happened just fine. So the question you might ask yourself is: what is different? And that leads to asking what class is the SNP1 object? If you can coerce into an array you probably can avoid the issue.
Jeremiah Rounds
Graduate Student
Utah State University
_________________________________________________________________
Get Free (PRODUCT) RED™ Emoticons, Winks and Display Pics.
[[alternative HTML version deleted]]
______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide
http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.