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

  • SEARCH
  • Home
  • 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 8431391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:50:33+00:00 2026-06-10T05:50:33+00:00

The task is to create a file (word, rtf, pdf, html, or whatever) that

  • 0

The task is to create a file (word, rtf, pdf, html, or whatever) that will capture the output of R (e.g: not the code that created the output), into that format (including text and images).

The way of doing this should involve as little change to the original R script as possible.

If I had cared only for the text or images, then I would use ?sink, or ?pdf. But I don’t know how to combine the two into one output in an easy way.

I know there is a way to export R output using r2wd, but it involves too much medaling in the original code for my taste (I imagine the same is true for the sweave solution, although I don’t have experience with it to tell)

Here is a sample code for future examples:

START.text.and.image.recording("output.file") # this is the function I am looking for
x <- rnorm(100)
y <- jitter(x)
print(summary(x))
print(head(data.frame(x,y)))
cor(x,y)
plot(x,y)
print(summary(lm(y~x)))
STOP.text.and.image.recording("output.file") # this is the function I am looking for

Update: I was asked way not Sweave, or other options from ReproducibleResearch task view.

The reasons are:

  1. I don’t (yet) know LaTeX
  2. Even knowing LaTeX, I want something with simple defaults to simply dump all the outputs together, and in order. “simply” means – as little extra code/file management overhead as possible.

I understand that something like sweave or brew are more scalable, but I am looking to see if there is a more “simple” solution for smaller projects/scripts.

  • 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-06-10T05:50:35+00:00Added an answer on June 10, 2026 at 5:50 am

    As of 2012 knitr provides a perfect solution to this problem.

    For example, create a file with an rmd extension. Wrap your code in a couple of commands as follows:

    ```{r}
    x <- rnorm(100)
    y <- jitter(x)
    print(summary(x))
    print(head(data.frame(x,y)))
    cor(x,y)
    plot(x,y)
    print(summary(lm(y~x)))
    ```
    

    You can convert it into a self-contained HTML file in several ways. In RStudio you just press a single button Knit HTML.
    This is the HTML file produced; to actually view how the HTML displays in a browser, save the file and open it.

    Images code, and output are interweaved as you might expect.

    Of course, you can and typically would divide up your file into multiple R code chunks. But the point is, you don’t have to.

    Here are another couple of examples I’ve created:

    • Getting started with R Markdown
    • Case study in using R Markdown
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been given a task to create a Python file that will take
In one app, I have a task to create files that will be used
I have a folder that will contain a temporary file that will be created
i have a task assigned that i have to create a text file (notepad)
If the task is to create a csv file out of some data where
I am trying to create a json file from a rake task using rabl.
I am trying to implement a gradle task to dynamically create a buildsignature.properties file
Using Script Task, I have written a code to create a folder and create
I have been task with (ha) creating an application that will allow the users
I have a very complex task - create a software that imports XMl files

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.