I have a set of data with 205 988 observation sand 10 variables , three of which are Legal_status, Date_of_incorporation and Last_year. 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.
-- View this message in context: http://r.789695.n4.nabble.com/If-loops-tp4648199.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.