[R] print one character on several lines

jim holtman jholtman at gmail.com
Fri Jun 20 14:04:29 CEST 2008


?strwrap

> cat(strwrap("This is a very long character and I want to print it on several lines. This is a very long character and I want to print it on several lines.", width=40),sep="\n")
This is a very long character and I
want to print it on several lines. This
is a very long character and I want to
print it on several lines.
>

On Thu, Jun 19, 2008 at 5:33 PM, Hua Li <hualihua at yahoo.com> wrote:
> Hi All,
>
> I'm wondering how I can print one large/long character on several lines so that the output will not overflow a page. Setting fill be TRUE or even numbers does not help. An example is below:
>
>
> ipuFile <- file("input.txt", "w")
>
> cat("This is a very long character and I want to print it on several lines. This is a very long character and I want to print it on several lines.",fill = TRUE,file = ipuFile)
>
> close(ipuFile)
>
> Thanks!
>
> Hua
>
> ______________________________________________
> 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list