On Mon, Jul 5, 2010 at 12:13 AM, Tim Joseph Dumol <[email protected]> wrote:
> Hi Andrezj,
>
> On Sun, Jul 4, 2010 at 11:54 PM, Andrzej Giniewicz <[email protected]> wrote:
>> Hi,
>>
>> recently I have given short introductory talk about Sage and questions
>> about integration with R arisen. Results of quickly put together code
>> is now at http://sagenb.org/home/pub/2232/ - especially, the question
>> was: "I have variable named x in R environment and want to get its
>> value, or variable named x inside Sage environment and push its value
>> into R, but keep the name." - what I was able to think about is quick
>> hack with .GlobalEnv of R, but is there better way to do what is
>> presented in the notebook linked above? Is there some syntax like
>> r["x"]=[1,2,3] or sth? If there is, I haven't noticed it yet - would
>> be thankful for hints.
>>
>> Cheers,
>> Andrzej.
>>
>> --
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/sage-support
>> URL: http://www.sagemath.org
>>
>
> This should do what you wanted:
>
> sage: r('x <- c(1,2,3)')
> [1] 1 2 3
> sage: r('x')
> [1] 1 2 3
> sage: sageobj(r('x')) # r('x').sage() works too
> [1, 2, 3]
> sage: r([1, 2, 3])
> [1] 1 2 3
Oh, and:
sage: r.set('y', r([1,2,3]))
sage: r('y')
[1] 1 2 3
Try:
sage: r.<TAB>
for more commands.
> ---
> Tim Joseph Dumol <tim (at) timdumol (dot) com>
> http://timdumol.com
>
--
Tim Joseph Dumol <tim (at) timdumol (dot) com>
http://timdumol.com
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org