Re: [Rd] Syntactically valid names

From: Hadley Wickham <hadley_at_rice.edu>
Date: Tue, 05 Jul 2011 21:25:35 -0400

> What's wrong with that? They are names alright, just with special meanings.

But you can't really use them for variables:

> ... <- 4
> ...

Error: '...' used in an incorrect context
> ..1 <- 4
> ..1

Error: 'nthcdr' needs a list to CDR down

And make.names generally protects you against that:

> make.names("function")

[1] "function."
> make.names("break")

[1] "break."
> make.names("TRUE")

[1] "TRUE."
>>> x <- paste(rep("x", 1e6), collapse = "")
>>> x == make.names(x)
>> [1] TRUE
>
> Mildly insane, but technically OK, no?

I don't think so:

> x <- paste(rep("x", 1e6), collapse = "")
> assign(x, 1)
Error in assign(x, 1) : variable names are limited to 10000 bytes

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed 06 Jul 2011 - 01:36:03 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 06 Jul 2011 - 08:40:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive