[R] Rows assignment

From: Yuri Volchik <yuri.volchik_at_gmail.com>
Date: Fri, 25 Apr 2008 08:40:30 -0700 (PDT)

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.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 25 Apr 2008 - 16:02:52 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 25 Apr 2008 - 17:30:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive