ah, thanks - I know about r.tab, well - most of it are R commands, the
issue is that I didn't found those sage specific ones - it would help
if at least list of modified commands would appear in "r?" docstrings.
Anyway, is r.set working? I used:

sage: r.ls()
character(0)
sage: r.set('y', r([1,2,3]))
sage: r.ls()
[1] "sage0" "sage1" "sage2" "sage3" "sage4"

and there is no variable 'y' in R env. (using sage 4.4.2 here, was it
fixed/added/changed later on?) - anyway, variable 'y' is inserted when
I used:

%r
letSage <- function(variable,value) { .GlobalEnv[[variable]]<-value }

def setR(var, val):
    r.letSage('"%s"'%var, r(val))

and called it with:

setR('y', [1,2,3])

so it still isn't what I look for, thout the "r(...)" for "val" helped
to simplify it a lot. The r('var <- val') works, but requires to
specify val as R code, so it's not best way I think. I'm looking for
something you can pass list as argument, and preferably without r code
and function above. The r.set if it worked would be nice I think :)

cheers,
Andrzej.

On Sun, Jul 4, 2010 at 6:15 PM, Tim Joseph Dumol <t...@timdumol.com> wrote:
> On Mon, Jul 5, 2010 at 12:13 AM, Tim Joseph Dumol <t...@timdumol.com> wrote:
>> Hi Andrezj,
>>
>> On Sun, Jul 4, 2010 at 11:54 PM, Andrzej Giniewicz <ggi...@gmail.com> 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 sage-support@googlegroups.com
>>> To unsubscribe from this group, send email to 
>>> sage-support+unsubscr...@googlegroups.com
>>> 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 sage-support@googlegroups.com
> To unsubscribe from this group, send email to 
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at 
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to