[R] If loops?

David Winsemius dwinsemius at comcast.net
Fri Nov 2 02:01:44 CET 2012


On Nov 1, 2012, at 5:41 PM, kebrab67 wrote:

> I have a set of data with  205 988 observation sand 10 variables , three of
> which are Legal_status, Date_of_incorporation and . I set my time
> horizon from 1989 to 2009. Now I want to know when a company is dead. If
> Last_year is bigger or equal to 2009 then I say that a new "variable" last
> is 2009. If Last_year is smaller than 2009 then my new variable "last" is
> equal to the variable "Last_year". I wanted to know how I can generate this
> new variable and connect it to my original data called data.

last <- pmin(Last_year, 2009)


--
David Winsemius, MD
Alameda, CA, USA




More information about the R-help mailing list