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)))
> [1] 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.
Tomas> Thanks,
> Jialin
>
>
>> sessionInfo()
> R version 3.4.1 (2017-06-30)
> Platform: x86_64-suse-linux-gnu (64-bit)
> Running under: openSUSE Tumbleweed
>
> Matrix products: default
> BLAS: /usr/lib64/R/lib/libRblas.so
> LAPACK: /usr/lib64/R/lib/libRlapack.so
>
> locale:
> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
> [9] LC_ADDRESS=C LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods
> [7] base
>
> other attached packages:
> [1] magrittr_1.5
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel