substitute inconsistent output

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

substitute inconsistent output

Jan Gorecki
Dear R-devel,

Is there anything that we can do to make output of those call more
consistent? So the first one will return `c(1L, 2L)` rather than
`1:2`. Note that it is not related to compact integer sequence
introduced by altrep, it is reproducible on R 3.1.0 as well.

substitute(v+x, list(x=c(1L,2L)))
#v + 1:2
substitute(v+x, list(x=c(0L,2L)))
#v + c(0L, 2L)

Thank you,
Jan Gorecki

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: substitute inconsistent output

Duncan Murdoch-2
On 18/03/2020 1:36 a.m., Jan Gorecki wrote:

> Dear R-devel,
>
> Is there anything that we can do to make output of those call more
> consistent? So the first one will return `c(1L, 2L)` rather than
> `1:2`. Note that it is not related to compact integer sequence
> introduced by altrep, it is reproducible on R 3.1.0 as well.
>
> substitute(v+x, list(x=c(1L,2L)))
> #v + 1:2
> substitute(v+x, list(x=c(0L,2L)))
> #v + c(0L, 2L)
>

That's purely the deparser (the returned value from substitute doesn't
contain a call to ":"), but it's not optional.

So the output is consistent, it's the printing that is inconsistent.

Duncan Murdoch

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel