> Because in coding, I often end up with big chunks looking like this: > > ((mydataframeName$myvariableName > 2 & > !is.na(mydataframeName$myvariableName)) & > (mydataframeName$myotherVariableName == "male" & > !is.na(mydataframeName$myotherVariableName))) > > Which is much less readable/maintainable/editable than > > mydataframeName$myvariableName > 2 & mydataframeName$myotherVariableName == > "male"
Use subset: subset(mydataframeName, myvariableName > 2 & myotherVariableName == "male") (subset automatically treats NAs as false) Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/ ______________________________________________ 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.