[R] array manipulation

2011-11-04 Thread Simone Salvadei
This worked example, hoping to be helpful, has been requested after a (my) further enquiry about array manipulation. I was looking for a command that is equivalent to repmat() in matlab and that could also be applied to array. (for Matlab users) The Matlal code was the following: 1)temp_u=zeros

[R] array manipulation

2011-11-04 Thread Simone Salvadei
This worked example, hoping to be helpful, has been requested after a (my) further enquiry about array manipulation. I was looking for a command that is equivalent to repmat() in matlab and that could also be applied to array. (for Matlab users) The Matlal code was the following: temp_u=zeros(d

Re: [R] array manipulation

2011-11-03 Thread Patrick Burns
You seem to be looking for 'aperm'. There is a chapter in 'S Poetry' (available on http://www.burns-stat.com) that talks about working with higher dimensional arrays. I don't think any changes need to be made for R. On 02/11/2011 16:16, Simone Salvadei wrote: Hello, I'm at the very beginning o

Re: [R] array manipulation

2011-11-02 Thread David Winsemius
On Nov 2, 2011, at 12:16 PM, Simone Salvadei wrote: Hello, I'm at the very beginning of the learning process of this language. Sorry in advance for the (possible but plausible) stupidity of my question. I would like to find a way to permute the DIMENSIONS of an array. Something that sounds

[R] array manipulation

2011-11-02 Thread Simone Salvadei
Hello, I'm at the very beginning of the learning process of this language. Sorry in advance for the (possible but plausible) stupidity of my question. I would like to find a way to permute the DIMENSIONS of an array. Something that sounds like the function "permute()" in matlab. Given an array C

Re: [R] array manipulation

2010-04-14 Thread Bert Gunter
-project.org Subject: [R] array manipulation Hello listeRs, I'm trying to make a square radius around a given reference point. So given the following array, how can I manipulate it so that x0 <- array(1,dim=c(5,5)) x0 1 1 1 1 1 1 1 1 1 1 1 1 *1* 1 1 1 1 1 1 1 1 1 1 1 1 becomes into 3

[R] array manipulation

2010-04-14 Thread Muhammad Rahiz
Hello listeRs, I'm trying to make a square radius around a given reference point. So given the following array, how can I manipulate it so that x0 <- array(1,dim=c(5,5)) x0 1 1 1 1 1 1 1 1 1 1 1 1 *1* 1 1 1 1 1 1 1 1 1 1 1 1 becomes into 3 3 3 3 3 3 2 2 2 3 3 2 *1* 2 3 3 2 2 2 3 3 3 3 3 3

Re: [R] array manipulation simple questions

2009-02-23 Thread andrew
On Feb 24, 3:57 pm, jdeisenberg wrote: > Λεωνίδας Μπαντής wrote: > > > 1.   Suppose I have a<-c(1:10)  (or a<-array(c(1:10),dim=c(1,10))) > > > and I want to end up with vector b=[0 0 0 0 0 1 1 1 1 1]. i.e. I want to > > substitute alla elements that are <5 with 0 and >5 with 1. > > I think you

Re: [R] array manipulation simple questions

2009-02-23 Thread Gabor Grothendieck
2009/2/23 Λεωνίδας Μπαντής : > > Hi there, > > I am pretty new to R. Actually I started using it yesterday. I have two > questions: > > 1.   Suppose I have a<-c(1:10)  (or a<-array(c(1:10),dim=c(1,10))) > > and I want to end up with vector b=[0 0 0 0 0 1 1 1 1 1]. i.e. I want to > substitute alla

Re: [R] array manipulation simple questions

2009-02-23 Thread jdeisenberg
Λεωνίδας Μπαντής wrote: > > 1. Suppose I have a<-c(1:10) (or a<-array(c(1:10),dim=c(1,10))) > > and I want to end up with vector b=[0 0 0 0 0 1 1 1 1 1]. i.e. I want to > substitute alla elements that are <5 with 0 and >5 with 1. > I think you mean >=5, not > 5. In that case, try this:

[R] array manipulation simple questions

2009-02-23 Thread Λεωνίδας Μπαντής
  Hi there,   I am pretty new to R. Actually I started using it yesterday. I have two questions:   1.   Suppose I have a<-c(1:10)  (or a<-array(c(1:10),dim=c(1,10)))   and I want to end up with vector b=[0 0 0 0 0 1 1 1 1 1]. i.e. I want to substitute alla elements that are <5 with 0 and >5 with