Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6377241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:50:45+00:00 2026-05-25T01:50:45+00:00

I have a problem with the width of the output from echo within sweave,

  • 0

I have a problem with the width of the output from echo within sweave, I have a list with a large amount of text. The problem is the echo response from R runs off the page within the pdf. I have tried using

<<>>=
options(width=40)
@

but this has not changed anything.

An example: Set up the list (not showing in latex).

<<echo=FALSE>>=
my_list <- list(example="Site location was fixed using a Silvia Navigator handheld GPS     in October 2003.  Point of reference used was the station Bench Mark. If the bench mark location was remote from the site then the point of reference used was changed to the 0-1 metre gauge. Bench Mark location was then recorded as a separate entry in the Site History section [but not used as the site location].\r\nFor a Station location map and all digital photograph's of the station, river reach, and site details see H:\\hyd\\dat\\doc.  For non digital photo's taken prior to October 2003 please see the relevant station file at Tumut office.")
@

And show the entry of the list.

<<>>=
my_list
@

Is there any way that I can get this to work without having to break up the list with cat statements.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T01:50:45+00:00Added an answer on May 25, 2026 at 1:50 am

    You can use capture.output() to capture the printed representation of the list and then use writeLines() and strwrap() to display this output, nicely wrapped. As capture.output() returns a vector of strings containing the printed representation of the object, we can cat each of them to the screen/page but wrapped using strwrap(). The benefit of this approach is that the result looks like it was printed by R. Here’s the solution:

    writeLines(strwrap(capture.output(my_list)))
    

    which produces:

    $example
    [1] "Site location was fixed using a Silvia Navigator
    handheld GPS in October 2003.  Point of reference used
    was the station Bench Mark. If the bench mark location
    was remote from the site then the point of reference used
    was changed to the 0-1 metre gauge. Bench Mark location
    was then recorded as a separate entry in the Site History
    section [but not used as the site location].\r\nFor a
    Station location map and all digital photograph's of the
    station, river reach, and site details see
    H:\\hyd\\dat\\doc.  For non digital photo's taken prior
    to October 2003 please see the relevant station file at
    Tumut office."
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an odd problem. I'm trying to echo the response from a file
I have some interesting problem for an hour.. In my flex project, all width
I have a problem with my php/mysql script. It should only output the while
I have a problem with retrieving data from a database using PHP statements. At
reference from: Merging Variable PHP I have problem with $_POST getting blank null after
I'm interested in zipping the text output from a JSON object on a server
I have a problem with my script. I have this: <?php $r=mysql_query(SELECT * FROM
I have this batch file @ECHO OFF ECHO Please Enter Path of the View,
I have problem with return statment >.< I want to store all magazine names
I have problem with starting processes in impersonated context in ASP.NET 2.0. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.