Hi all, A simple question, new-ish to R, coming from Stata, and I yes I've looked at great length and not found ...
In Stata I might write (with * in place of #) # regress y on x in the set of observations where a==1 reg y x if a==1 # descriptives on x where a==1 su x if a==1 # generate a logical depending on the value of a variable gen z = (a == 1) # or likewise for a numeric gen x = y if a == 1 # show the values of a variable based on the value of another variable di y if a ~= . # generate a logical based on missing-ness of a variable gen w = (a~=.) or any of many similar operations conditional on the value of a variable. Believe it or not this is a big obstacle to learning R. --- Richard Sherman ______________________________________________ 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.