Displaying 1 result from an estimated 1 matches for "read001".
2010 Jun 29
2
Conditionally constructing columns in a data frame
...onstruct 5 new columns in a data frame depending on
the value of another of the columns in the data frame. The only way I
could figure out to do this was to subset the data frame five times, do
the variable construction, and then rbind the subsets back together.
Here's part of the code I used:
read001 <- read[read$existstr=="001",]
read001$era1end <- NA
read001$era2base <- NA
read001$era2end <- NA
read001$era3base <- read001$era1base
read001$era3end <- read001$era3base + (6 * read001$era3tr)
read011 <- read[read$existstr=="011",]
read011$er...