[Rd] strange value in .Last.value

Duncan Murdoch murdoch.duncan at gmail.com
Wed Jun 5 13:59:54 CEST 2013


On 13-06-05 3:35 AM, Andreas Leha wrote:
> Hi Winston,
>
> Winston Chang <winstonchang1 at gmail.com> writes:
>
>> This is the result of the withVisible() function, which is called by
>> source(). This should illustrate what it does:
>>
>>> withVisible(1+1)
>> $value
>> [1] 2
>>
>> $visible
>> [1] TRUE
>>
>>
>>> withVisible(invisible(1+1))
>> $value
>> [1] 2
>>
>> $visible
>> [1] FALSE
>>
>
>
> Thanks for this.
>
> But besides the technical reason of the $visible element being part of
> .Last.value from a sourced statement, I guess my question is whether it
> is intended to be there.
>
> As I take it, it is.  Thus, ess/orgmode -- which relies on .Last.value
> for results handling and does not expect that $visible element -- should
> adapt and ignore that explicitly?

I think you'll need to ask on the ESS list what the intentions are in 
this case.  The result of source() is a list with the value and visible 
entries.  This has been true "forever", it's not new behaviour.  (It's 
unfortunate that this is not clearly documented.)

Duncan Murdoch



More information about the R-devel mailing list