1 | initial version |

When you start Sage, `r`

is the R interpreter.

Maybe you defined `r`

as something else?

In a new Sage session, the following works:

```
sage: r
R Interpreter
sage: x = r([10.4,5.6,3.1,6.4,21.7]); x
[1] 10.4 5.6 3.1 6.4 21.7
```

Suppose we define `r`

to some value, then it stops working (of course).

```
sage: r = 2
sage: r
2
sage: x = r([10.4,5.6,3.1,6.4,21.7]); x
Traceback (most recent call last)
...
TypeError: 'sage.rings.integer.Integer' object is not callable
```

If we reset `r`

, then it works again.

```
sage: reset('r')
sage: r
R Interpreter
sage: x = r([10.4,5.6,3.1,6.4,21.7]); x
[1] 10.4 5.6 3.1 6.4 21.7
```

2 | No.2 Revision |

When ~~you start Sage, ~~Sage starts, `r`

is predefined as the R interpreter.

~~Maybe you defined ~~(Edit: this does not seem to be the case in CoCalc.)`r`

as something else?

In a new Sage session, with `r`

predefined as above, the following works:

```
sage: r
R Interpreter
sage: x = r([10.4,5.6,3.1,6.4,21.7]); x
[1] 10.4 5.6 3.1 6.4 21.7
```

Suppose we define `r`

to some value, then it stops working (of course).

```
sage: r = 2
sage: r
2
sage: x = r([10.4,5.6,3.1,6.4,21.7]); x
Traceback (most recent call last)
...
TypeError: 'sage.rings.integer.Integer' object is not callable
```

If we reset `r`

, then it works again.

```
sage: reset('r')
sage: r
R Interpreter
sage: x = r([10.4,5.6,3.1,6.4,21.7]); x
[1] 10.4 5.6 3.1 6.4 21.7
```

In versions of Sage where `r`

is not predefined as the R interpreter, use:

```
sage: from sage.interfaces.r import r
```

In a Sage session where `r`

was initially the R interpreter,
but was then redefined to be something else, this can also
be used, instead of `reset('r')`

, to restore `r`

as the R interpreter.

3 | No.3 Revision |

When Sage starts, `r`

is predefined as the R interpreter.

(Edit: this does not seem to be the case in CoCalc.)

In a new Sage session, with `r`

predefined as above, the following works:

```
sage: r
R Interpreter
sage: x = r([10.4,5.6,3.1,6.4,21.7]); x
[1] 10.4 5.6 3.1 6.4 21.7
```

~~Suppose ~~If in such a Sage session we ~~define ~~assign some `r`

to ~~value, ~~other value to `r`

,
then it stops working (of course).

```
sage: r = 2
sage: r
2
sage: x = r([10.4,5.6,3.1,6.4,21.7]); x
Traceback (most recent call last)
...
TypeError: 'sage.rings.integer.Integer' object is not callable
```

If we reset `r`

, then it works again.

```
sage: reset('r')
sage: r
R Interpreter
sage: x = r([10.4,5.6,3.1,6.4,21.7]); x
[1] 10.4 5.6 3.1 6.4 21.7
```

~~In versions of Sage where ~~To set `r`

is not predefined as `r`

to be the R interpreter, whether the Sage
being used predefines `r`

that way or not, use:

```
sage: from sage.interfaces.r import r
```

In a Sage session where `r`

was initially the R interpreter,
but was then redefined to be something else, this can also
be used, instead of `reset('r')`

, to restore `r`

as the R interpreter.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.