This worked
I needed to grab the code out of a markdown document and I had a sense that there was function for this. However, there is a function to take to convert an R script to an Rmarkdown document. It is the spin
function. Here was my introduction to the function.
I am not sure if there is function to do the reverse.
Anyway Chat-GPT created a script for me to use and it worked perfect. Here is the script link to the chat