On 12/4/06, Peter Dalgaard <[EMAIL PROTECTED]> wrote: > Robin Hankin wrote: > > Peter > > > > Aha! so R backticks work just like bash backticks (duh!) > > > > Er, no. Backticks in shells have a command inside that will be evaluated > and replaced by its output. (This is a bit confusing, but single and > double quotes were already taken at the time...)
This shell-like behavior is also available in the gsubfn package which allows one to process string arguments in arbitrary functions using backticks by prefacing the function in question with fn$. For example, by prefacing cat with fn$ we have: > library(gsubfn) > fn$cat("pi = $pi, pi/2 = `pi/2`\n") pi = 3.14159265358979, pi/2 = 1.57079632679490 > > > unless they are on the LHS of an assignment. > > > > [We bash people now use $(...) instead] > > > > Could we add something to this effect to Quotes.Rd? > > > > > > rksh > > > > > > On 4 Dec 2006, at 14:33, Peter Dalgaard wrote: > > > > > >> Robin Hankin wrote: > >> > > [snip] > > > >>> What exactly do backticks do that single or double quotes don't? > >>> > >>> > >> I don't know whether we really want to be that dogmatic about it, > >> but in > >> a nutshell > >> > >> `like this` <- 2 > >> "like that" <- 3 > >> print(`like this`) > >> print("like that") > >> > >> I.e. backtick'ed names work whereever ordinary names do, but quoted > >> names work only on the LHS of assignments. > >> > >> The note in ?formula should probably be understood defensively: We > >> intend backtick'ed names to work in all contexts, but there may be > >> programming practices where the backticks are not preserved > >> (notably if > >> there is a deparse-reparse step involved). > >> > >> > >>> Where do I look for documentation on this? > >>> > >>> > >>> > >>> > >>> -- > >>> Robin Hankin > >>> Uncertainty Analyst > >>> National Oceanography Centre, Southampton > >>> European Way, Southampton SO14 3ZH, UK > >>> tel 023-8059-7743 > >>> > >>> ______________________________________________ > >>> R-help@stat.math.ethz.ch 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. > >>> > >>> > >> -- > >> O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B > >> c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K > >> (*) \(*) -- University of Copenhagen Denmark Ph: (+45) > >> 35327918 > >> ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) > >> 35327907 > >> > > > > -- > > Robin Hankin > > Uncertainty Analyst > > National Oceanography Centre, Southampton > > European Way, Southampton SO14 3ZH, UK > > tel 023-8059-7743 > > > > ______________________________________________ > > R-help@stat.math.ethz.ch 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. > > > > > -- > O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B > c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K > (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 > ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 > > ______________________________________________ > R-help@stat.math.ethz.ch 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. > ______________________________________________ R-help@stat.math.ethz.ch 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.