Thank you, David. I believe you have made the thing more clear to me. Best Regards, Xie YM
在 2013-02-06 16:14:18,"David Winsemius" <dwinsem...@comcast.net> 写道: > >On Feb 5, 2013, at 10:48 PM, 谢一鸣 wrote: > >> Thanks David, your solution perfectly solve my problem. But Do you >> know what exactly the mechanism of "Computing on the language" in >> pdf file: "R language definition", Can that "THING" do the same job? >> > >I wouldn't consider that to be "computing on the language. There is an >entire Section 6 regarding "computing on the Language". I don't see >evidence that you have read it yet. "Computing on the language" >generally refers to manipulation objects of 'language' class before >they get evaluated. > >-- >David. > >> Thank you very much! >> Xie YM >> >> 2013-02-06 14:22:57,"David Winsemius" <dwinsem...@comcast.net> 写 >> 道: >>> The "$" construction is only a syntactic shortcut for >>> "[["argument"]]. >>> What you are looking for is described in the ?"[[" page. You should >>> be >>> constructing a formal that is assigned a syntactically legal column >>> name ... NOT "ANYTHING I WANT". Perhaps: >>> >>> function(dfrm , colname = "V1") { >>> return( dfrm[[ colname ]] ) >>> # the argument will get evaluated as "V1" unless an alternate colname >>> argument is supplied >>> } >>> >>> ( You can't get "$" to evaluate a character column name.) >>> >>> -- >>> David Winsemius, MD >>> Alameda, CA, USA >>> > >David Winsemius, MD >Alameda, CA, USA > ______________________________________________ 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.