variable (column) in a data frame
On Jul 15, 2012, at 17:41 , Paulo Barata wrote:
Dr. Dalgaard, Thank you. But pre-checking with is.null() or using with() doesn't solve the problem of catching spelling mistakes in the name of a variable inside a data frame, when using the df$var notation often in a program. Is there some way for R to behave, in relation to a variable inside a data frame, the same way it behaves for a variable not in a data frame? For example:
You could try reading the 2nd half of my one-line reply....
You can pre-check for is.null(df$aaa) or use with(df, sum(aaa==2)).
Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com