I tried the following R commands in order to generate an R file:
library(knitr)
purl("/Readme.md")
But I get an R empty file.
Extract function RStudio comes with a tool that can help you build functions. To use it, highlight the lines of code in your R script that you want to turn into a function. Then click Code > Extract Function in the menu bar.
To transform your markdown file into an HTML, PDF, or Word document, click the “Knit” icon that appears above your file in the scripts editor. A drop down menu will let you select the type of output that you want. When you click the button, rmarkdown will duplicate your text in the new file format.
To open a new file, click File > New File > R Markdown in the RStudio menu bar. A window will pop up that helps you build the YAML frontmatter for the . Rmd file. Use the radio buttons to select the specific type of output that you wish to build.
As mnel suggests, your problem is probably with '/'. So first make sure you are in the correct directory:
getwd()
Then check your file exists:
file.exists("Readme.md")
Then this should work:
knitr::purl("Readme.md")
##Or
knitr::purl("./Readme.md")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With