Re: [R] Line feed for a long character string

From: Duncan Murdoch <murdoch.duncan_at_gmail.com>
Date: Wed, 11 May 2011 18:14:39 -0400

On 11/05/2011 4:46 PM, Lisa wrote:
> Dear all,
>
> Does anyone know how to make a line feed automatically based on the width of
> console window? For example, when you cat() a long character string just
> like this:

You can use the strwrap() function to insert line breaks. If it's not under your control, and the function you're using tries to print something wider than the console, what happens depends on what console you're using. The Windows Rgui does what you describe. Windows Rterm will send all the characters, and cmd.exe or whatever shell you're using will probably insert breaks when it hits the end of the line.

Duncan Murdoch

> cat("Seminar series is an opportunity for students to learn about ongoing
> researches in the field of mathematics, computer science, physics,
> chemistry, and some other related programs. Students must complete a seminar
> attendance form and return to their mentors.\n")
>
> In my computer, about half of the string is displayed with a symbol “$”at
> the end that looks like this:
>
>> cat("Seminar series is an opportunity for students to learn about ongoing
>> researches in the field of mathematics, computer science, physics,
>> chemistry, a$
>
> Any help will be appreciated!
>
> Lisa
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Line-feed-for-a-long-character-string-tp3515824p3515824.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.



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. Received on Wed 11 May 2011 - 22:27:46 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 12 May 2011 - 03:50:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive