[R] Changing line length in Sweave output works for numeric, but not for character vectors
Simon Kiss
sjkiss at gmail.com
Mon Aug 20 23:03:41 CEST 2012
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
Please avoid sending me Word, PowerPoint or Excel attachments. Sending these documents puts pressure on them to use Microsoft software and helps to deny them any other choice. In effect, you become a buttress of the Microsoft
monopoly. This pressure is a major obstacle to the broader adoption of free software.
To convert to plain text choose Text Only or Text Document as the Save As Type. Your computer may also have a program to convert to PDF format. Select File, then Print. Scroll through available printers and select the PDF converter. Click on the Print button and enter a name for the PDF file when requested.
More information about the R-help
mailing list