Ask Your Question
1

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

asked 2014-02-05 16:37:47 +0100

anonymous user

Anonymous

updated 2014-02-05 17:53:38 +0100

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 18:27:54 +0100

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 22:10:37 +0100 )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 16:37:47 +0100

Seen: 675 times

Last updated: Feb 06 '14