R Markdown is a file format for making dynamic documents with R. An R Markdown document is written in markdown (an easy-to-write plain text format) and contains chunks of embedded R code. Markdown is a simple formatting syntax for authoring HTML, PRESENTATIONS, PDF, and MS Word documents
It has three types of content which include text, code chunks and YAML metadata which build
R Markdown.
✔YAML metadata consists of information about the title, author, date, and output. It starts and ends with three dashes (---).
✔Code chunks can be run without interference from the text. Multiple code chunks of different programming languages like Python and SQL can also be included in the same document. A single code can also be run and output can be viewed for the corresponding code in the R console. A code should start with ```{r} and end with ```, so that code is isolated from text and other codes.
✔Text can be made as a header using space along with hashtag #(Header 1), ##(Header 2), and ###(Header 3). It can be italicized with *x* or bold with **x**
✔The result of the code run can also be seen in the form of output along with an explanation and code in the same document after clicking on the 'knit' option.
R Markdown file
It can be generated by clicking the R markdown in the new file option. A dialog box appears with a Title, Author, Date, and Default output Format to select HTML, PDF, or Word.
An untitled file with YAML metadata, text and code chunks appear. When you click the **Knit** button a document will be generated that includes both contents as well as the output of any embedded R code chunks within the document.
After saving the file, select knit to HTML, which will result in an HTML document containing all the information of YAML metadata, text, code chunks and output which will make it easier to view the output of different kinds of datasets in one file. It can also be knit to PDF or Word which will is effortless to share information containing output along with code
Please check this URL for my git https://github.com/Divya090597/R/blob/df9018f904ce0e5a3eab18278e4f47308edda7f6/knit.Rmd
Comments
Post a Comment