On 03/28/2018 08:31 AM, Jialin Ma wrote:
> Dear all,
> It seems that as.pairlist does not convert call objects, producing
> results like the following:
>> is.pairlist(as.pairlist(quote(x + y)))
>  FALSE
> Should this behavior be expected?
The documentation says that the behavior of as.pairlist is undocumented
in this case:
‘as.pairlist’ is implemented as ‘as.vector(x, "pairlist")’, and
hence will dispatch methods for the generic function ‘as.vector’.
Lists are copied element-by-element into a pairlist and the names
of the list used as tags for the pairlist: the return value for
other types of argument is undocumented.
as.pairlist implementation does currently nothing for a language object
(because it is internally represented using a linked list). is.pairlist
implementation is checking whether it's argument is a user-level
pairlist, which language object is not, so it returns FALSE in the example.
These functions are rather low-level and should not be needed in user
programs. Certainly programs should not depend on undocumented behavior.