4
I have a code that reads the XML files that are in an enterprise network folder, and generates a file .RData
. I have other codes that generate different reports for different sectors, using as a basis the RData
. My problem is: these XML files are updated at various frequencies and I can’t always tell when the last update was performed. I wonder if there is any function that runs this other code (which generates the RData
) whenever you generate a report, precisely to avoid an outdated XML-based Rdata file and have to run the other code manually every time a new report is requested.
PS: I know I can insert the code that reads XML into the report code, but I don’t do it to prevent the report from getting too long .
Edit: the script leiturapastaDIPR.R
generates the file DIPRConsolidado.RData
.Rdata is a list with 5 elements and each of them is a Data Frame. Then this Rdata is loaded into Rmarkdown markdown.RMD
that generates the PDF of the report. If you need any more information!
You can use the function
source()
, but the script will be read every time, even if the XLM has not changed. Another more elegant solution would be to create amakefile
in which it will run this R script only when the XLM changes. If you give more information about the names of the scripts, data and the order of execution, we can help in building themakefile
.– Willian Vieira
The
source()
nor would itself be a problem, but from what I understood thismakefile
seems to be a more elegant solution!– Flavio Silva
That,
source()
is not a problem but an inefficient solution (in a matter of time wasted repeating analyses that have already been done). I will post here as an answer amakefile
basic that will serve as an example for your problem.– Willian Vieira