Displaying 1 result from an estimated 1 matches for "vaslinks4".
2011 Aug 26
3
elegant way to check if 2 values are in 3 columns?
...PSS, SAS or STATA)
The exercise in question is to relabel the column "treat" to "1", if
"yearsep" is smaller than 1988 and columns "proc1"-"proc3" contain the
values 56.36 or 59.81.
My pathetic solution to do this in R currently looks like this:
vaslinks4$treat <- 0
vaslinks4$treat[vaslinks4$yearsep < 1988 && (vaslinks4$proc1 %in%
c(56.36,59.81)
|| vaslinks4$proc2 %in% c(56.36,59.81)
|| vaslinks4$proc3 %in% c(56.36,59.81))] <- 1
But I'm sure there is a more elegant solution for this, in which I would...