Re: [R] Replace missing values within a group with the non-missing value

2013-04-08 Thread Adams, Jean
Graham, # use dput() to share your data in a way that's easy for R-help readers to use mydf <- structure(list(dn = c(4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L), obs = c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 4L), choice = c(0L,

[R] Replace missing values within a group with the non-missing value

2013-04-06 Thread GRAHAM LEASK
I have a large dataset organised in choice groups see below. Each choice represents a separate occasion with 1 product chosen out of the 6 offered.            +-+      | dn   obs   cho