Dear list,
Does anyone know if there is a function that replaces a matrix of NAs 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.478356969557745
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
))
On Thu, Dec 3, 2009 at 11:41 AM, Farida Mostajabi
f0mos...@louisville.eduwrote:
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
Yes, should be 6 0.2. The code worked. Thank you!
William Dunlap wdun...@tibco.com 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 03, 2009 8:41 AM
To: r-help@r
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:
Dear R experts,
I
It worked perfectly. Thank you!
On Wed, Dec 30, 2009 at 12:21 PM, Henrique Dallazuanna www...@gmail.comwrote:
Try this:
unique(x)[rep(1:nrow(unique(x)), m),]
On Wed, Dec 30, 2009 at 2:35 PM, farida...@gmail.com wrote:
Dear All,
I have a matrix like X and need to create a new matrix
6 matches
Mail list logo