0

For example, if I had a file tmp2.R containing:

(x1=1)
(x2=2)
(x3=3)

x1
x2
x3

Then sourcing the file generates the following:

> source("tmp2.R",echo=TRUE)

> (x1=1)
[1] 1

> (x2=2)
[1] 2

> (x3=3)
[1] 3

> x1
[1] 1

> x2
[1] 2

> x3
[1] 3

Matlab has a similar default behaviour which spaces things out. I can have it squeeze out the blank lines by the command 'format compact'. The effect would be:

> source("tmp2.R",echo=TRUE)
> (x1=1)
[1] 1
> (x2=2)
[1] 2
> (x3=3)
[1] 3
> x1
[1] 1
> x2
[1] 2
> x3
[1] 3

You can see much more on the screen. Just wondering if there is a way to get this effect in R?

Cœur
  • 37,241
  • 25
  • 195
  • 267
user36800
  • 2,019
  • 2
  • 19
  • 34
  • 3
    Welcome to Stack Overflow! It will help others to help you if you provide code and some sample data so we can see what your output looks like now, and also you should include how you would like it to look. This removes a lot of guesswork for those who might answer the question. See this link [on how to make a reproducible R example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – Jota Apr 17 '15 at 19:20
  • 1
    Done. Thanks for the pointer, Frank. – user36800 Apr 20 '15 at 15:30

0 Answers0