[R] Changing line length in Sweave output works for numeric, but not for character vectors
Enrico Schumann
es at enricoschumann.net
Tue Aug 21 12:00:45 CEST 2012
Hi Simon
try strwrap(test)
regards,
Enrico
Am 20.08.2012 23:03, schrieb Simon Kiss:
> Hi there: I'm preparing a report in RStudio 0.96.330 on a Mac OS. I'm running R 2.15.0
>
> I understand from Ross Ihaka's document (http://www.stat.auckland.ac.nz/~stat782/downloads/Sweave-customisation.pdf) that you can modify the line length of Sweave output by a call to options(wdith=x).
>
> This works great for me for numeric output, but not for character vectors that I have to print. The following is some sample code that illustrates my problem.
>
> Is there a different way to format character vectors that are stored in R?
> Yours, Simon Kiss
>
> \documentclass{article}
>
> \begin{document}
> \SweaveOpts{concordance=TRUE}
>
> <<echo=TRUE, results=verbatim>>=
> seq(1,100,1)
> @
>
> <<echo=TRUE, results=verbatim>>=
> options(width=30)
> @
> <<echo=TRUE, results=verbatim>>=
> seq(1,100,1)
> @
>
> <<echo=TRUE, results=verbatim>>=
> test<-c('The government should do more to advance societys goals, even if that means limiting the freedom and choices of individuals.')
> @
>
> \end{document}
> *********************************
> Simon J. Kiss, PhD
> Assistant Professor, Wilfrid Laurier University
> 73 George Street
> Brantford, Ontario, Canada
> N3T 2C9
> Cell: +1 905 746 7606
>
More information about the R-help
mailing list