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
If in such a Sage session we assign some 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
To set 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.
We need much more information to understand your problem. Which version of Sage were you using before it failed? Was it Sage on your computer or online? Was it the Sage notebook or Jupyter?
+1 with Vincent. What did you type precisely to get an error ? On latest Sage version, i have:
Thanks for reporting this bug. This bug is now tracked at https://github.com/sagemathinc/cocalc/issues/2564 .