Dear list,
Does anyone know if there is a function that replaces a matrix of "NA"s in
an array with the previous matrix with numbers? For example, I have an
array
ab <- array(dim=c(3,3,15),dimnames=list(rows=1:3,cols=1:3,dim=times)) .
Select out put from the array is:
, , dim = 0.4783569695577
It worked perfectly. Thank you!
On Wed, Dec 30, 2009 at 12:21 PM, Henrique Dallazuanna wrote:
> Try this:
>
> unique(x)[rep(1:nrow(unique(x)), m),]
>
>
> On Wed, Dec 30, 2009 at 2:35 PM, wrote:
> > Dear All,
> >
> > I have a matrix like X and need to create a new matrix based on the
> vector
>
Thanks! That's what I need.
On Tue, Dec 29, 2009 at 1:33 PM, Dimitris Rizopoulos <
d.rizopou...@erasmusmc.nl> wrote:
> have a look at ?ave(), e.g.,
>
> A <- 1:10
> B <- factor(c(1,2,2,4,4,4,7,7,7,7))
>
> ave(A, B)
>
>
> I hope it helps.
>
> Best,
> Dimitris
>
>
> farida...@gmail.com wrote:
>
>> D
Yes, should be 6 0.2. The code worked. Thank you!
>>> William Dunlap 12/03/09 12:07 PM >>>
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Farida Mostajabi
> Sent: Thursday, December 0
hu, Dec 3, 2009 at 11:41 AM, Farida Mostajabi
wrote:
> Hi all,
>
> I have a vector like this:
>
> x<- c(0.7, 0.1, 0, 0.2, 0.2, 0, 0, 0 , 0, 0.4, 0, 0.8, 1.8)
>
> I would like to replace the zero values with the first previous non zero
> value.
>
> my returni
Hi all,
I have a vector like this:
x<- c(0.7, 0.1, 0, 0.2, 0.2, 0, 0, 0 , 0, 0.4, 0, 0.8, 1.8)
I would like to replace the zero values with the first previous non zero value.
my returning vector should look like this:
y<-c( 0.7, 0.1, 0.1,0.2,0.2,0.2,0.2,0.2, 0.4, 0.4, 0.8, 1.8)
How can I do
6 matches
Mail list logo