lf Of Allan
> Tanaka
> Sent: Thursday, March 16, 2017 3:16 AM
> To: William Dunlap
> Cc: r-help@r-project.org
> Subject: Re: [R] HELP ME: Fill NA Values from the previous Non-NA Values
>
> Hi. Thanks for the function. My bad, after looking at the csv file, it seems
>that
> N
r-help@r-project.org
> Subject: Re: [R] HELP ME: Fill NA Values from the previous Non-NA Values
>
> Hi. Thanks for the function. My bad, after looking at the csv file, it seems
> that
> NA values come not only from previous Non-NA values but also from the
> next Non-NA values. Exa
Hi. Thanks for the function. My bad, after looking at the csv file, it seems
that NA values come not only from previous Non-NA values but also from the next
Non-NA values. Example:
| NCQ05 | 11.395 |
| NCQ05 | 11.395 |
| NCQ05 | |
| NCQ06 | |
| NCQ06 | 13 |
| NCQ06 | 13 |
If i use the functi
values only within
identifiers
Cheers
Petr
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Allan
> Tanaka
> Sent: Wednesday, March 15, 2017 12:09 PM
> To: r-help@r-project.org
> Subject: [R] HELP ME: Fill NA Values from the previo
You could use the following function
locf2 <- function(x, initial=NA, IS_BAD = is.na) {
# Replace 'bad' values in 'x' with last previous non-bad value.
# If no previous non-bad value, replace with 'initial'.
stopifnot(is.function(IS_BAD))
good <- !IS_BAD(x)
stopifnot(is.logical
The following is an example:
| Item_Identifier | Item_Weight |
| FDP10 | 19 |
| FDP10 | |
| DRI11 | 8.26 |
| DRI11 | |
| FDW12 | 8.315 |
| FDW12 | |
The following is the one that i want to be. That is, filling NA values from the
previous Non-NA values.
| Item_Identifier | Item_Weight |
| FDP
6 matches
Mail list logo