Ask Your Question
1

Is there any way to suppress the extra white space from compiling in R?

asked 2014-02-05 09:37:47 -0500

anonymous user

Anonymous

updated 2014-02-05 10:53:38 -0500

Whenever I compile my R code, I get a lot of extra white space that just clogs my worksheet. Is there any way to suppress this? (Without changing the code to be on the same line using semicolons.) I'm working in Sage Worksheets on the cloud.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-02-06 11:27:54 -0500

William Stein gravatar image

I've made some changes to slightly reduce whitespace in R mode for SageMathCloud (https://cloud.sagemath.com); restart your project to get this update. However, due to how Sage works they might not be sufficient. If you evaluate the following in a cell (in sage mode, or put %sage at the top), it will eliminate a lot of additional whitespace in %r mode.

def r_eval0(*args, **kwds):
    return sage.interfaces.r.R.eval(sage.interfaces.r.r, *args, **kwds).strip().replace('\n\n','')
sage_salvus.r_eval0 = r_eval0
edit flag offensive delete link more

Comments

Think this is worth adding to Sage? Assuming the `.strip()` wouldn't strip *too* much - R likes to indent info in longer output sometimes...

kcrisman gravatar imagekcrisman ( 2014-02-06 15:10:37 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2014-02-05 09:37:47 -0500

Seen: 98 times

Last updated: Feb 06 '14