R markdown report examples

We have a shiny dashboard to view certain metrics and tables . I am trying understand if there are examples of using some analysis to generate reports based of dynamic tables. For eg: using mtcars table can we use markdown to write:

Based on table mtcars , mazda and hornet have better mileage and respective values for engines with 4 cylinders.

Please let me know if you have any examples for markdown I can refer to, thank you.

I kind of understand of your question "is this possible to generate a Rmd report from inside a shiny app and download it?"

For this question, look into the shiny website article
You'll find example of using parametrized report to generate a report and a demo app also.

You can follow this example to create a parametrized report of your choice then generate the html output based on the values of parameters from your interactive app and dynamic choices

Hope it helps.