[Rd] write.table

John Chambers jmc@research.bell-labs.com
Thu, 7 Dec 2000 09:23:02 -0500 (EST)


> Cc: p.dalgaard@biostat.ku.dk, r-devel@stat.math.ethz.ch
> From: Peter Dalgaard BSA <p.dalgaard@biostat.ku.dk>
> Date: 07 Dec 2000 14:22:25 +0100
> Sender: owner-r-devel@stat.math.ethz.ch
> Precedence: bulk
> 
> Prof Brian Ripley <ripley@stats.ox.ac.uk> writes:
> 
> > > Just to pick a nit: Could we make a habit of distinguishing between
> > > "names" and "identifiers"? The latter being the syntactical term in
> > > the R language, briefly the names that you don't need to use get() to
> > > access. "123" and "Height in cm" are valid names, but not valid
> > > identifiers.
> > 
> > The argument is called `check.names', and has description
> > 
> > check.names: if `TRUE' then the names of the variables in the data
> >           frame are checked to ensure that they are valid variable
> >           names.  If necessary they are adjusted (by `make.names') so
> >           that they are.
> > 
> > So `make.names' should be renamed as `make.identifiers'.  That is
> > described as
> > 
> > make.names               package:base               R Documentation
> > 
> > Make Legal R Names Out of Strings
> > 
> > Description:
> > 
> >      Make legal R names out of every `names[i]' string. Invalid
> >      characters are translated to `"."'.
> > 
> > 
> > More plausibly, you are proposing a new distinction ....
> 
> Hmm. The current distinction would seem to be between "names" and
> "legal R names" or "valid variable names", of which certainly the
> latter is misleading since you can easily have variables with weird
> names like "[<-". But you're probably right that we are to some extent
> stuck with existing terminology, here and elsewhere. I think I would
> want to push a convention of using "R names" for the syntactical
> entities, then.  
> 
> -- 
>    O__  ---- Peter Dalgaard             Blegdamsvej 3  
>   c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
>  (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
> ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 

The original S language authors shoulder the blame here, if there
maybe was a way to make the distinctions clearer by choosing
terminology better.  Being stuck with a vague use of `name', let me
suggest something roughly as follows.

(By the way, should this be on the FAQ?  I didn't see it there.)

The term `name' is used in four different (but related) ways in the
language:

1.  A `syntactic name' is a string the parser interprets as this type
    of expression.  It consists of letters, numbers, and the dot
    character and starts with a letter or the dot.

2.  An `object name' is a string associated with an object that is
    assigned in an expression either by having the object name on the
    left of an assignment operation or as an argument to the `assign'
    function.  It is usually a syntactic name as well, but can be any
    non-empty string if it is quoted (and it's always quoted in the
    call to `assign').

3.  An `argument name' is what appears to the left of the equals sign
    when supplying an argument in a function call (for example,
    `f(trim=.5)').  Argument names are also usually syntactic names,
    but again can be anything if they are quoted.

4. A `file name' is a string identifying a file in the operating
   system for reading, writing, etc.  It really has nothing much to do
   with names in the language, but it's traditional to call these
   strings file `names'.

I'd slightly discourage using the term "R name" because there is
nothing really R-dependent here.

There are some more details one can mention, such as that
non-syntactic argument names are usually only going to be matched by
"..." since the parser requires syntactic names for formal arguments.
But such details probably will only confuse if put in the FAQ.

John

-- 
John M. Chambers                  jmc@bell-labs.com
Bell Labs, Lucent Technologies    office: (908)582-2681
700 Mountain Avenue, Room 2C-282  fax:    (908)582-3340
Murray Hill, NJ  07974            web: http://www.cs.bell-labs.com/~jmc
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._