Re: [R] Matrix and list indices

2011-09-28 Thread fernando.cabrera
Thanks Michael it works! Have to say it is amazing what you can do in R with a few lines (a line in this case) of code. Fernando From: R. Michael Weylandt [mailto:michael.weyla...@gmail.com] Sent: 27. september 2011 15:43 To: Cabrera, Fernando Álvarez Subject: Re: [R] Matrix and list indices

Re: [R] Matrix and list indices

2011-09-27 Thread R. Michael Weylandt
On Tue, Sep 27, 2011 at 9:43 AM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > Untested, I believe this should work, though you might need to modify for > floating point funny business in testing the equalities: > > my_list <- list( earth=array(c(0,0,45,0,0,45,0,45),dim=c(2,2,2)), > m

[R] Matrix and list indices

2011-09-27 Thread fernando.cabrera
Hi guys, I am trying to replace all elements of earth that are equal to zero with their corresponding elements in mars. I can do the replace with a bunch of for-loops, but I don't think this is the R way of doing things. my_list <- list( earth=array(c(0,0,45,0,0,45,0,45),dim=c(2,2,2)), mars=ar