[R] backticks
Peter Dalgaard
P.Dalgaard at biostat.ku.dk
Mon Dec 4 15:33:00 CET 2006
Robin Hankin wrote:
> I noticed just now that
> package.skeleton() produces R files in which
> the function names are escaped with backticks.
>
> ?Quotes says that "The preferred quote is the backtick (`)",
> but I don't understand _why_ this is preferred.
>
> ?formula gives some clues but points out that there
> are no guarantees that formulae using non-syntactic names such as
> `like this` will be accepted.
>
> 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 at 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
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list