[R] Rows assignment

Yuri Volchik yuri.volchik at gmail.com
Fri Apr 25 17:40:30 CEST 2008


Hi to all members,

i encountered a weird problem when trying to assign subset of rows in a
matrix.
Simple example works fine:
z<-matrix(NA,ncol=3,nrow=10)
z[,1]<-1:10
y<-matrix(1:30,ncol=3,nrow=10)
y[,1]<-5:14
z[z[,1]%in%y[,1],2]<-y[y[,1]%in%z[,1],2]
z
z[z[,1]%in%y[,1],]<-y[y[,1]%in%z[,1],]
z


When i try it on a bigger matrix it works fine when i try to assign 1
element, but converts original matrix to a list when trying to assign 2 or 3
columns for example.
What can be a problem, as it seems that matrices are both numbers only?


Thanks
-- 
View this message in context: http://www.nabble.com/Rows-assignment-tp16896591p16896591.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list