Creating a mail merge like report with multiple child reports?


I'm fairly new RMarkdown so I'm looking to see if what I want to do is possible from someone with more experience than me.

I have a set of text survey answers data. About 900 responses, with 1 - 5 answers per response (answer fields weren't mandatory on survey). There are about 3,500 answers. We sent the text answers to the Watson Tone Analyzer to determine the tone and score.. The tone analyzer looks at the answer text and provides a number of tones. I need is a clean way of presenting this all of this information.

My thought was to use multiple rmd files passing parameters. I need to loop through all the responses, display their answers, and then the tone and scores for each answer. For each response, there is at least 1 questions answered, and 5 at most. The tones could have several records, or could have none at all.

This is a rough layout of what I want to do.

Response 1
Question 1:
Document Tones
Tone Name
Sentence Tones
Sentence Text:
then on to the next response...

I thought I could use the response as the parent, the question a the first level child, then the document and sentence tones as children under the question. I would need to pass the response_id and the question_num to each child record through a few loops. I would display the document and sentence tone information in tables which I assume would be easy if I can get the params to filter the data.

Is my idea feasible in RMarkdown? I haven't seen much info about subreports but maybe that not the correct terminology?

Any advice is appreciated.


You might want to check out parameterized reports. Chapter 15 Parameterized reports | R Markdown: The Definitive Guide
17.4 Parameterized reports | R Markdown Cookbook (this example talks about running multiple reports)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.