I'm wondering if someone can tell me how R determines where to wrap lines in its output. I'd like to understand this because occasionally often after running a script the output of R no longer wraps at the correct location. For example, the statement, '1:40' would ordinarily return something like this... [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21] 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 and is instead returning longer lines like this... [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 As you can imagine this makes it hard to read output because the results no longer line up in nice columns. This seems to happen without my having resized the window but resizing the window can occasionally make it better. Thanks, Matthew Other details: System: Mac OS X v.10.4.11 Running R from command line (Terminal.app) or from R.app
Matthew Fero <mfero at fhcrc.org> wrote in news:35F5A13F-5CEC-469B-A707-D2F9BD84377A at fhcrc.org: ?options #... and look at the width parameter> options(width = 100) > 1:40[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 [33] 33 34 35 36 37 38 39 40 There may be Mac specifics in your question since you note resizing "fixes" the problem in some instances. After a day or two, you might post it again on the Mac-SIG list ... after you do further experiments with code from the scripts that exhibit this output anomaly.> I'm wondering if someone can tell me how R determines where to wrap > lines in its output. > > I'd like to understand this because occasionally often after running > a script the output of R no longer wraps at the correct location. > For example, the statement, '1:40' would ordinarily return something > like this... > > [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 > 18 19 20 > [21] 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 > > and is instead returning longer lines like this... > > [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 > 18 19 20 > 21 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 > > As you can imagine this makes it hard to read output because the > results no longer line up in nice columns. This seems to happen > without my having resized the window but resizing the window can > occasionally make it better.> > Other details: > System: Mac OS X v.10.4.11 > Running R from command line (Terminal.app) or from R.app > > ______________________________________________>
On Fri, 18 Apr 2008, Matthew Fero wrote:> I'm wondering if someone can tell me how R determines where to wrap > lines in its output. > > I'd like to understand this because occasionally often after running > a script the output of R no longer wraps at the correct location.Try options( "width" ) source( "your-script.R" ) options( "width" ) I would guess that your script is changing options("width") and that resizing silently changes it to a suitable value. If so you can do this old.options <- options( "width" ) source( "your-script.R" ) options( width = old.options$width ) HTH, Chuck> For example, the statement, '1:40' would ordinarily return something > like this... > > [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 > 18 19 20 > [21] 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 > > and is instead returning longer lines like this... > > [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 > 18 19 20 > 21 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 > > As you can imagine this makes it hard to read output because the > results no longer line up in nice columns. This seems to happen > without my having resized the window but resizing the window can > occasionally make it better. > > Thanks, > > Matthew > > > Other details: > System: Mac OS X v.10.4.11 > Running R from command line (Terminal.app) or from R.app > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >Charles C. Berry (858) 534-2098 Dept of Family/Preventive Medicine E mailto:cberry at tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901