Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This is a limitation of the interface with R that we use. See here.

              # If an input is longer than this number of characters, then
              # try to switch to outputting to a file. 
              eval_using_file_cutoff=1024)

You could certainly hack your own local copy of Sage to change this, and this is the preferred option.

If you are using a server you don't have access to, you might be able to use a different hack. From the file sage/interfaces/expect.py:

    By default, a long command (length exceeding ``self._eval_using_file_cutoff``)
    is evaluated using :meth:`_eval_line_using_file`.

    If the optional ``wait_for_prompt`` is ``False`` then even a very
    long line will not be evaluated by :meth:`_eval_line_using_file`,
    since this does not support the ``wait_for_prompt`` option.

You might see some examples of how to use the Sage evaluation option to use the interface with that option. It might have to be a line-by-line option. Or you might be able to define a new interface MyR which is the same as the R interface by doing something like

MyR = R(eval_using_file_cutoff=10000)
MyR('thestringyouwant to evaluate')

but in this case you'd lose the drop-down menu efficiency.

This is a limitation of the interface with R that we use. See here.

              # If an input is longer than this number of characters, then
              # try to switch to outputting to a file. 
              eval_using_file_cutoff=1024)

You could certainly hack your own local copy of Sage to change this, and this is the preferred option. (You'll have to do ./sage -b before restarting the server.)

If you are using a server you don't have access to, you might be able to use a different hack. From the file sage/interfaces/expect.py:

    By default, a long command (length exceeding ``self._eval_using_file_cutoff``)
    is evaluated using :meth:`_eval_line_using_file`.

    If the optional ``wait_for_prompt`` is ``False`` then even a very
    long line will not be evaluated by :meth:`_eval_line_using_file`,
    since this does not support the ``wait_for_prompt`` option.

You might see some examples of how to use the Sage evaluation option to use the interface with that option. It might have to be a line-by-line option. Or you might be able to define a new interface MyR which is the same as the R interface by doing something like

MyR = R(eval_using_file_cutoff=10000)
MyR('thestringyouwant to evaluate')

but in this case you'd lose the drop-down menu efficiency.

This is a limitation of the interface with R that we use. See here.

              # If an input is longer than this number of characters, then
              # try to switch to outputting to a file. 
              eval_using_file_cutoff=1024)

You could certainly hack your own local copy of Sage to change this, and this is the preferred option. (You'll have to do ./sage -b before restarting the server.)

If you are using a server you don't have access to, you might be able to use a different hack. From the file sage/interfaces/expect.py:

    By default, a long command (length exceeding ``self._eval_using_file_cutoff``)
    is evaluated using :meth:`_eval_line_using_file`.

    If the optional ``wait_for_prompt`` is ``False`` then even a very
    long line will not be evaluated by :meth:`_eval_line_using_file`,
    since this does not support the ``wait_for_prompt`` option.

You might see some examples of how to use the Sage evaluation option to use the interface with that option. It might have to be a line-by-line option. Or you might be able to define a new interface MyR which is the same as the R interface by doing something like

MyR = R(eval_using_file_cutoff=10000)
MyR('thestringyouwant to evaluate')

but in this case you'd lose the drop-down menu efficiency.

Edit:

The reason things (should) work anyway when you aren't asking for output to show up is that this method of the Expect interface (what we use to talk to R) will take long commands, write them to a file, and run them. So all variables should be defined fine. However, that means that it will create any auxiliary files (like graphics) in that context, which won't show up in the notebook since the computation wasn't done "in the cell".

The auxiliary file is defined here, which for me was

$ pwd
/Users/<snip>/.sage/temp/GC04855.local/15413/interface