Questions tagged [locf]

Last observation carried forward (LOCF), This method is specific to longitudinal data problems.

Last observation carried forward (LOCF) This method is specific to longitudinal data problems.

For each individual, missing values are replaced by the last observed value of that variable.

In scientific software for statistical computing and graphics, function na.locf from package zoo implements this method.

48 questions
0
votes
1 answer

Last observation carried forward in a data frame

Part of a funtion I am including in an R-package involves filling NAs with last ovbservation carried forward (locf). The locf should be implemnted to all columns in the data frame except what I called below the good columns goodcols (i.e. should be…
daragh
  • 173
  • 1
  • 11
0
votes
2 answers

Last observation carried forward conditional on multiple columns

I have a dataset with this structure: ID = c(1,1,1,1,2,2,2,3,3,3,3) L40 = c(1, NA, NA, NA, 1, NA, NA, NA, 1, NA, NA) K50 = c(NA, NA, NA, NA, NA, 1, NA, NA, NA, NA, 1) df = data.frame(ID, L40, K50) # ID L40 K50 # 1 1 1 NA # 2 1 NA NA # 3 …
udden2903
  • 783
  • 6
  • 15
-3
votes
2 answers

Populate fields in SAS by ID and Date

My dataset looks like this: AsAtDate ReleaseDate ID Var1 Var2 ... Var5 200701 200601 1 x . 200702 200601 1 . a 200703 200601 1 . . 200701 200702 2 . b 200702 200702 2 y …
EmShing
  • 29
  • 9
1 2 3
4