Suppose you want to create a huge number of pdf files through RMarkdown and pandoc, each of them including a statistical analysis on a part of your data, for example on each row of your data frame.

You need to write a .R file with cycles from 1 to the number of rows of your data set the instructions contained in a .Rmd file.

Suppose that:

  1. your data set name is data.csv and its path is datapath/data.csv’’
  2. your .Rmd file name is report.Rmd and its path is basepath/report.Rmd’’

An R code to produce n pdf, where n is the number of rows of your data set could be something like this:

In next article I will explain to you how send by mail these n PDF files to n different recipients simply exploiting the power of R!

Print Friendly, PDF & Email