First of all I am new to R programming. Also I found some topics that are very close to what I cannot solve but don't really help me in the end.
I have inherited a report which pastes some graphs in a folder in the form of .png images which are then knitted in a word report.
I have managed to automate the someScriptIn.R part and it is able to analyse a .csv file to find out how many data sets it has to analyse and set the titles,dates,etc right. It produces the images just fine.
You have to know that what I want to do is to have a dynamically changing report in terms of number of data sets, titles etc. So it will not be let's say 3 sets of images every time. it may be 1 it may be 10. This will depend on the user. Also the Series.title is a variable created in someScriptIn.R as well as Series.quarter.
The issue starts when I try to use knitr with an .rmd file that looks like the below code.
Code:
---
output: word_document
---
```{r, echo=FALSE, results='hide'}
# source(".../someScriptIn.R") # this will produce the graphs
```
`r Series.title[1]` `r Series.quarter` Quarters Forecast # here Series.title[1] is Group 1



`r Series.title[1]` `r Series.quarter` Quarters Forecast # here Series.title[2] is Group 2



`r Series.title[1]` `r Series.quarter` Quarters Forecast # here Series.title[3] is Group 3



The question is how to go through this with a for loop having in mind that the graphs are already created images in a folder? Is this solution able to solve my problem and what will the implementation be?