[R] Current Terminal (console) width

Bert Gunter bgunter.4567 at gmail.com
Fri Jan 20 18:02:52 CET 2017


David et al:

from ?options

"width:
controls the maximum number of columns on a line used in printing
vectors, matrices and arrays, and when filling by cat.

[as Jared said]

...
Some R consoles automatically change the value when they are resized."

So this behavior depends on the unstated by both of you console in
which R is running.


Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Fri, Jan 20, 2017 at 8:29 AM, David L Carlson <dcarlson at tamu.edu> wrote:
> I cannot replicate that on Windows 8 (64 bit or 32 bit):
>
>> options('width')
> $width
> [1] 90
>
> # Drag the window to resize, then:
>
>> options('width')
> $width
> [1] 124
>
> -------------------------------------
> David L Carlson
> Department of Anthropology
> Texas A&M University
> College Station, TX 77840-4352
>
> -----Original Message-----
> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Jared Studyvin
> Sent: Friday, January 20, 2017 10:18 AM
> To: Ben Tupper <btupper at bigelow.org>
> Cc: r-help mailing list <r-help at r-project.org>
> Subject: Re: [R] Current Terminal (console) width
>
> Ben,
>
> That options control is about the size of what is printed. I'm looking for
> the actual size of the window in real time.
>
> options('width') ## returns 80
> resize the terminal window
> options('width') ## returns 80
>
> Sys.getenv('COLUMNS') ## returns current window width
> resize the terminal window
> Sys.getenv('COLUMNS') ## returns a different value
>
> This however does not work on a Windows OS.
>
> Thanks,
>
>
>
>
> *Jared Studyvin, PhD *
> *Statistician*
>
>
> Environmental & Statistical Consultants
> 200 S. Second Street
> Laramie, WY 82070
> (307) 721-3179
> jstudyvin at west-inc.com
> www.west-inc.com
>
> *Follow WEST: *Facebook
> <http://www.facebook.com/pages/Western%E2%80%90EcoSystems%E2%80%90Technology%E2%80%90WESTInc/125604770807646>
> , Twitter <http://twitter.com/WestEcoSystems>, Linked In
> <http://www.linkedin.com/company/1458419>, Join our Mailing list
> <http://visitor.r20.constantcontact.com/manage/optin/ea?v=001qrD4A3S5xJ5KgMyelH9jyw%3D%3D>
>
> CONFIDENTIALITY NOTICE:  This message and any accompanying communications
> are covered by the Electronic Communications Privacy Act, 18 U.S.C. §§
> 2510-2521, and contain information that is privileged, confidential or
> otherwise protected from disclosure.  If you are not the intended recipient
> or an agent responsible for delivering the communication to the intended
> recipient, you are hereby notified that you have received this
> communication in error.  Dissemination, distribution or copying of this
> e-mail or the information herein by anyone other than the intended
> recipient, or an employee or agent responsible for delivering the message
> to the intended recipient, is prohibited.  If you have received this
> communication in error, please notify us immediately by e-mail and delete
> the original message.  Thank you.
>
> P Please consider the environment before printing.
>
>
> On Fri, Jan 20, 2017 at 8:48 AM, Ben Tupper <btupper at bigelow.org> wrote:
>
>> Hi,
>>
>> Have you looked at
>>
>> > > options("width")
>> > $width
>> > [1] 80
>>
>> and does that get at what you need?
>>
>> Ben
>>
>>
>>
>>
>> > On Jan 20, 2017, at 9:58 AM, Jared Studyvin <jstudyvin at west-inc.com>
>> wrote:
>> >
>> > Hello,
>> >
>> > On a non Windows OS the following command: Sys.getenv("COLUMNS")
>> > Will return the current width of the R terminal (console) but this does
>> not
>> > work on a Windows OS.
>> >
>> > Does anyone know equivelant R code when install on a Windows OS?
>> >
>> > I'm using WIndows 10 Pro Version: 1607; R 3.3.2
>> >
>> > Thanks,
>> >
>> > *Jared Studyvin, PhD *
>> > *Statistician*
>> >
>> >
>> > Environmental & Statistical Consultants
>> > 200 S. Second Street
>> > Laramie, WY 82070
>> > (307) 721-3179
>> > jstudyvin at west-inc.com
>> > www.west-inc.com
>> >
>> > *Follow WEST: *Facebook
>> > <http://www.facebook.com/pages/Western%E2%80%90EcoSystems%E2%80%
>> 90Technology%E2%80%90WESTInc/125604770807646>
>> > , Twitter <http://twitter.com/WestEcoSystems>, Linked In
>> > <http://www.linkedin.com/company/1458419>, Join our Mailing list
>> > <http://visitor.r20.constantcontact.com/manage/optin/ea?v=
>> 001qrD4A3S5xJ5KgMyelH9jyw%3D%3D>
>> >
>> > CONFIDENTIALITY NOTICE:  This message and any accompanyi...{{dropped:19}}
>> >
>> > ______________________________________________
>> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> > 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.
>>
>> Ben Tupper
>> Bigelow Laboratory for Ocean Sciences
>> 60 Bigelow Drive, P.O. Box 380
>> East Boothbay, Maine 04544
>> http://www.bigelow.org
>>
>>
>>
>>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.



More information about the R-help mailing list