Reformatting all code chunks in an R Markdown document

I have a number of R Markdown documents and I'd like to have all the code chunks in all of the documents reformatted using the same method we get when we use Ctrl+Shift+A in the editor. Is that possible?

Going chunk by chunk and manually selecting the code then pressing Ctrl+Shift+A is going to take a looooong time.

How about style_dir() from the styler package, which restyles all files in a given directory.

1 Like

Perfect! Many thanks.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.