[R] Word wrapping for character objects (WINDOWS R ONLY)

From: Toby Marthews <Toby.Marthews_at_lsce.ipsl.fr>
Date: Wed, 11 Jun 2008 14:52:01 +0200 (CEST)


Can anybody help me with this problem? ** ONLY WINDOWS R - PROBLEM DOESN'T OCCUR ON LINUX ** I want to print a long character to screen:

> getOption("width")

[1] 60
> z=(1:20)/10 #z is a vector of length between 20 and 30 (depending on
user options) containing lengths in mm (i.e. each element is 1-5 characters long)
> str1=paste("The depths chosen are (",toString(z),") mm, and more text
...\n")
> cat(str1)

The depths chosen are ( 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.$
>

The problem is that on R for Windows the string is cropped by the window size (hence the "$"). On R for Linux, this doesn't happen and the text is "word wrapped" (the default for the shell, I guess):

> cat(str1)

The depths chosen are ( 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3,
1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2 ) mm, and more text ...
>

I can't find any option for "word wrapping" in the cat command (fill=TRUE has no effect). I also checked the menu Edit -> GUI preferences..., but there doesn't seem to be a "Word Wrap" option there either.

How do I get word wrapping like this in Windows? Perhaps the attached screenshots clarify this question.

THANKS FOR ANY HELP!
Toby Marthews

Previous relevant posts:

Received on Wed 11 Jun 2008 - 18:36:40 GMT

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 Wed 11 Jun 2008 - 19:30:39 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