[R] How '.' is used?
bates at stat.wisc.edu
Sun Aug 9 18:53:32 CEST 2009
On Sun, Aug 9, 2009 at 11:32 AM, Ted
Harding<Ted.Harding at manchester.ac.uk> wrote:
> On 09-Aug-09 16:06:52, Peng Yu wrote:
>> I know '.' is not a separator in R as in C++. I am wondering where it
>> discusses the detailed usage of '.' in R. Can somebody point me a
>> webpage, a manual or a book that discuss this?
> To the best of my knowledge, apart from its specific use as a separator
> between the integer and fractional parts of a number, "." has no specific
> use in R, and you can, for instance, use it just as you would use an
> alphanumeric character in a name.
> For instance, you could do
> . <- 1.2345
> #  1.2345
> . <- function(x) x^2
> #  144
> So, unless there is something I don't know about, there is hardly
> anything to discuss about "the detailed usage of '.' in R"!
The ',' character is one of the characters allowed in names, hence it
can be used as you have suggested. There are (at least) two special
usages of the '.' in names. Following the time-honoured Unix
convention, names that begin with '.' are considered "hidden" names
and not listed by ls() or objects() unless you set all.names = TRUE in
the call. Because of this convention it is inadvisable to use names
starting with '.' except when you wish to avoid potential name
conflicts. The second special use of '.' in a name is in the
construction of the names of S3 method functions. The method for
generic function "foo" applied to class "bar" is named "foo.bar".
More information about the R-help