Re: [Rd] What do you call the value that represents a missing argument?

2010-10-09 Thread Peter Dalgaard
On 10/09/2010 01:51 PM, Hadley Wickham wrote:
>> It is a 'dotted pair list'
> 
> But:
> 
>> is.pairlist(formals(plot)$x)
> [1] FALSE
> 
> Hadley
> 

Vitaly is right that it is implemented as as.symbol(""), although
there's a safeguard against doing just that (and it is not like it is
imperative to have that particular implementation). It isn't really
supposed to live in the wild, but as you have noticed there are a couple
of ways to circumvent the safeguards, mainly due to the need to be able
to manipulate a function's argument list.

We did at some point play around with the idea of making "missing arg"
an official first-class object, but found ourselves in the same position
as the man who invented the acid that dissolves everything: These things
are hard to store

> y <- alist(x=)$x
> z <- y
Error: argument "y" is missing, with no default

(I have forgotten whether there's a reason that the above doesn't fail
already on the assignment to y. Somehow it would have been more logical
if missing values could _only_ appear inside lists. Except in actual
function arguments, of course.)

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] What do you call the value that represents a missing argument?

2010-10-09 Thread Hadley Wickham
> It is a 'dotted pair list'

But:

> is.pairlist(formals(plot)$x)
[1] FALSE

Hadley

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

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] symbol and symbols help files

2010-10-09 Thread Patrick Burns

I think it makes sense to have
'symbol' in the See Also of 'symbols'
and vice versa.


--
Patrick Burns
pbu...@pburns.seanet.com
http://www.portfolioprobe.com/blog
http://www.burns-stat.com
(home of 'Some hints for the R beginner'
and 'The R Inferno')

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] What do you call the value that represents a missing argument?

2010-10-09 Thread Vitally S.
Hadley Wickham  writes:

> What's the correct way to create an object like this?  (for example if
> you are manipulating the formals of a function to add an argument with
> no default value, as in 
> http://stackoverflow.com/questions/3892580/).as.symbol("") returns an error.  
> Both substitute() and bquote() return
> that object, but it's not obvious if this is on purpose.

The question on stackoverflow was concerned with the creation of such an object:

Obvious way:
x <- alist(x=)$x

Because the object like that seems to be a zero length name 

as.symbol("") #should be able to produce it

quote() #is another meaningful candidate which does not work

instead substitute() and bquote() works fine. Funny thing is that the behavior
of bquote() and quote() are not expected to be different in this case.

Vitally.


>
> Hadley

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel