Try na.locf from the zoo package and then use merge with specified suffixes:
library(zoo)
f - function(x) {
rownames(x) - NULL
merge(x, na.locf(x[-1], na.rm = FALSE), by = 0, suffixes = c(, .by))[-1]
}
do.call(rbind, by(x, x$id, f))
On 3/7/07, Jon Olav Vik [EMAIL PROTECTED] wrote:
Dear
Dear list,
Is there a way to programmatically specify tag names for the ... (ellipsis)
part of the argument list to a function? In other words, a way to do this:
x - data.frame(A=1:5)
if the name A was not hardcoded but given by a variable, and without
resorting to:
x - data.frame(1:5)