From the error message it seems you are including installation commands in your Rmd file and that is a bad idea. But we can't be sure since you are not providing enough information.
To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one: