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 6894081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:44:17+00:00 2026-05-27T06:44:17+00:00

I am just discovering Sweave and R . I have seen some examples of

  • 0

I am just discovering Sweave and R. I have seen some examples of Sweave documents and have also started to write one or two on my own. I am impressed by the ability of doing computations in R and outputting results directly in a LaTeX document.

Now I am thinking of bigger documents (as we usually have with LaTeX) that consist of several pages and several parts. With LaTeX (I use WinEdt), I set a main document (e.g. main.tex) and then have other subsidiary documents like introduction.tex, discussion.tex etc.

My question is: Can we do this with Sweave as well? Now I am working with single Sweave document (.Rnw) alone. Can we have multiple Sweave documents (with one main and the secondary ones) like we normally do with LaTeX?

A workaround would be to have separate Sweave files and then sweave them to produce the R LaTeX chunks which can be copied to a LaTeX document but then the whole idea seems quite inefficient and time consuming.

Please do let know what suggestions and solutions that you have.

Thanks a lot…

  • 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-27T06:44:18+00:00Added an answer on May 27, 2026 at 6:44 am

    Here is what works very well for me:

    I have one master file (“master.Rnw”) that has no text but only serves to collect the files (chapters, sections) which form the document in the end.

    Then I have one file with R code that is being reused in various other files (“func.Rnw”). Here, I have lot of named chunks

    <<my_fun_1,eval=FALSE,echo=FALSE>>=
    # code:
    c <- a * b
    @
    

    In master.Rnw, the first thing after \begin{document} I do is

    \SweaveInput{func.Rnw}
    

    and from there, I have my named chunks available. In a file “chap1.Rnw” I can now have

    <<echo=FALSE>>=
    a <- 10
    b <- 25
    <<my_fun_1>>
    c
    @
    

    Of course, I have to

    \SweaveInput{chap1.Rnw})
    

    into master.Rnw.

    I only have to \Sweave{master.Rnw} and then pdflatex the resulting master.tex file, no copying/ pasting or processing of multiple files.

    I’m just writing a paper of 60+ pages with about 25 tables and figures and everything works perfectly well so far.

    Hope this helps,
    Rainer

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just discovering LINQ and finding it great. One problem thoush is that I
i just started discovering serviceStack ORMlite , and i am trying to figure out
I have a C++/Obj-C background and I am just discovering Python (been writing it
I'm just discovering log4cxx logging framework. It seems there are two different syntaxes for
I am just learning how to use Terracotta after discovering it about a month
Just checking my JS and I have an error, but I cannot see where.
Just learning the world of jquery, and all my googling gives examples like this:
Just a knowledge question which I would like to ask: For example, I have
I am discovering how to use git. I just made the following test: create
In one of my Controllers, I have multiple URLs that will ultimately render in

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.