Hi,
c1 = (1,2,3,4,5,6,NA,7,8,NA,9,10,NA)
library(zoo)
na.locf(c1)
# [1] 1 2 3 4 5 6 6 7 8 8 9 10 10
A.K.
Hi, I want to fix an array that contains several NA elements. And I
would like to replace them with the previous valid element.
So my array c = (1,2,3,4,5,6,NA,7,8,NA,9,10,NA)
Hi everyone
I have a problem with replacing the NA values with the mean of the column which
contains them. If I replace Na with the means of the rest values in the column,
the mean of the whole column will be still the same as if I would have omitted
NA values. I have the following data
de
On 29-07-2013, at 18:39, iza.ch1 iza@op.pl wrote:
Hi everyone
I have a problem with replacing the NA values with the mean of the column
which contains them. If I replace Na with the means of the rest values in the
column, the mean of the whole column will be still the same as if I
Dear iza.ch1,
I hesitate to say this, because mean imputation is such a bad idea, but it's
easy to do what you want with a loop, rather than puzzling over a cleverer
way to accomplish the task. Here's an example using the Freedman data set in
the car package:
colSums(is.na(Freedman))
Consider the following:
f - function(x){
m - mean(x, na.rm = TRUE)
x[is.na(x)] - m
x
}
apply(de, 2, f)
HTH,
Jorge.-
On Tue, Jul 30, 2013 at 2:39 AM, iza.ch1 iza@op.pl wrote:
Hi everyone
I have a problem with replacing the NA values with the mean of the column
which contains them. If
On 29-07-2013, at 18:39, iza.ch1 iza@op.pl wrote:
Hi everyone
I have a problem with replacing the NA values with the mean of the column
which contains them. If I replace Na with the means of the rest values in the
column, the mean of the whole column will be still the same as if I
Hi,
de- structure(c(NA, NA, NA, NA, NA, NA, NA, NA, 0.27500571, -3.07568579,
-0.42240954, -0.26901731, 0.01766284, -0.8099958, 0.20805934,
0.03036708, -0.26928087, 1.20925752, 0.38012008, -0.41778861,
-0.49677462, -0.13248754, -0.54179054, 0.35788624, -0.41467591,
-0.59234248, 0.73642396,
-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf
Of arun
Sent: Monday, July 29, 2013 10:58 AM
To: iza.ch1
Cc: R help
Subject: Re: [R] replace Na values with the mean of the column which contains
them
Hi,
de- structure(c(NA, NA, NA, NA, NA, NA, NA, NA
On Jul 29, 2013, at 9:39 AM, iza.ch1 wrote:
Hi everyone
I have a problem with replacing the NA values with the mean of the column
which contains them. If I replace Na with the means of the rest values in the
column, the mean of the whole column will be still the same as if I would
have
Dear list,
I'm trying to replace NA-values with the preceding values in that column.
This code works, but I am sure there is a more elegant way...
df - data.frame(id = c(A1, NA, NA, NA, B1,
NA, NA, C1, NA, NA, NA, NA),
value = c(1:12))
rn -
try 'na.locf' in the zoo package
On Mon, Jun 21, 2010 at 7:52 AM, Patrick Hausmann
patrick.hausm...@uni-bremen.de wrote:
Dear list,
I'm trying to replace NA-values with the preceding values in that column.
This code works, but I am sure there is a more elegant way...
df - data.frame(id =
11 matches
Mail list logo