[R] Current Terminal (console) width
Jeff Newmiller
jdnewmil at dcn.davis.ca.us
Fri Jan 20 23:08:33 CET 2017
For clarity, maintenance of the COLUMNS environment variable is a feature of certain terminal drivers, and is therefore an operating system feature, not an R feature.
--
Sent from my phone. Please excuse my brevity.
On January 20, 2017 1:40:38 PM PST, Ista Zahn <istazahn at gmail.com> wrote:
>Hi Jared,
>
>On Jan 20, 2017 1:36 PM, "Jared Studyvin" <jstudyvin at west-inc.com>
>wrote:
>
>Ista,
>
>I use R through Emacs. I'm trying to get this to work there.
>
>
>Here is how ESS calculates the width of the comint buffer:
>
>https://github.com/emacs-ess/ESS/blob/e21af4d2a09c6cb6061e8cd9f0f5cacadedcccc3/lisp/ess-inf.el#L2449
>
>This works cross-platform.
>
>At a more basic level I'm disappointed that when I use R on my Mac I
>can
>get this information but when I use R on Windows I can not.
>
>
>Sounds like an issue that should be taken up with microsoft.
>
>
>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 10:29 AM, Ista Zahn <istazahn at gmail.com> wrote:
>
>> On Fri, Jan 20, 2017 at 11:52 AM, Jared Studyvin
><jstudyvin at west-inc.com>
>> wrot:
>> > David,
>> >
>> > When using native R GUI that does work because the option is
>checked to
>> do
>> > that. See Edit -> GUI Preferences...
>> >
>> > I'm looking for the R code that will do that same thing so when R
>is not
>> > being run in the native GUI I can ensure that same behavior.
>>
>> You still have not told use where it IS being run. That might be
>> useful information.
>>
>> Best,
>> Ista
>>
>> >
>> > 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=00
>> 1qrD4A3S5xJ5KgMyelH9jyw%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 9: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.
>> >>
>> >
>> > [[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/posti
>> ng-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>>
>
> [[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.
More information about the R-help
mailing list