Skip to content
Prev 385837 / 398503 Next

how to turn column into column names and fill it with values

A simpler, cleaner, and maybe faster approach is to use outer():

nm <- unique(dat$PLATE)
dat <- cbind(dat, 1+outer(dat$PLATE,nm,  "=="))
names(dat)[-(1:3)] <- nm

Bert

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Tue, Sep 29, 2020 at 11:20 AM Rui Barradas <ruipbarradas at sapo.pt> wrote: