r - How to best generate multiple HTML files from RMarkdown based on one dataset? -
I have an RMMarks report which is very useful and has many pages long with all the statistics and tables in HTML file .
It uses the same dataset for all data and tables.
I keep this large HTML file and then several new subdirectories with their own HTML files and subdirectories, each with their own html files.
In this case, the full report contains data from a department, then each subdirectory will have an html output related to each group, and each of them has HTML output for each person in each group. Together there will be a subdirectory. In this way, if someone is interested in only one group, or one person's metric, then they look at the most suitable output.
Parent DIR: Data for the same large HTML file with which the data and tables are generated for the whole department. __Subdir for each group: output based on the same data, but only the group's metric. __Subdir For each person: Output based on the same data but only individual matrix What is the best way to arrange this?
1. Is there any code chuck option in RMardkown where I can say, in this HTML output file Chuck goes one, Chuck B goes into another?
2. Do I need several RMMarkDown files, one for every HTML output, there is a need for some kind of caching between Dick, so I do not have to reprocess data? (It seems silly because I need lots of HTML files)
Should I give RMarkdown to this task?
I do something like you're proposing with knit, and it's very well Works.
Do not tell anyone, but I use 'For Loop' for a cycle through a bunch of councils, each of which gets the same report but with their data. I then push in a directory structure, zip it and mail it to it.
I have an RMD file that has two datasets, set A (being a subject) and set b (its partners)
The flow is something like this: < Pre> (set, topic == report) setB & lt; - Filters (set, topic! = Report) output_html & lt; set & lt; - assemble_data () # loads for the entire set (report in report_list) {setA < - str_c ('path /', report, 'html') knit_interim & lt; - str_c ('path /', report, 'MD') knit_pattern & lt; - 'Name of RMd' # I generate more than one report for each place (knit_pattern) markdowntoHTML (file = knit_interim, output = output_html, stylesheet = stylesheet, encoding = 'windows-1252')} In this way, I can set a report for a few minutes. My case may be simpler than you, because the report structure is the same - this is a dataset that changes.
Note that this is not a paste of code (it is slightly more complicated than this), so be careful about typo and so on.
The point (as I think) is to write the RMD which expects the dataset of a particular name, and the R code provides the local area for it. I had fought with it in the beginning, but it is quite easy to execute all.
[Update: 'How do you pass data to RMD files?'
You do not need to explicitly expect data in Set A and Set B in my code above RAMD.
This makes workflow really easy - you write a template using a dataset (manually filter for one) and then when you're ready, you can only run the loop As I said, I used to work a bit for the first time, but jumped on the bus and all worked very well.
Comments
Post a Comment