diff --git a/sources/tech/20230216.1 ⭐️⭐️ Beginner's Guide to R Markdown Syntax [With Cheat Sheet].md b/sources/tech/20230216.1 ⭐️⭐️ Beginner's Guide to R Markdown Syntax [With Cheat Sheet].md deleted file mode 100644 index 8011186f98..0000000000 --- a/sources/tech/20230216.1 ⭐️⭐️ Beginner's Guide to R Markdown Syntax [With Cheat Sheet].md +++ /dev/null @@ -1,369 +0,0 @@ -[#]: subject: "Beginner's Guide to R Markdown Syntax [With Cheat Sheet]" -[#]: via: "https://itsfoss.com/r-markdown/" -[#]: author: "Sreenath https://itsfoss.com/author/sreenath/" -[#]: collector: "lkxed" -[#]: translator: "lxbwolf" -[#]: reviewer: " " -[#]: publisher: " " -[#]: url: " " - -Beginner's Guide to R Markdown Syntax [With Cheat Sheet] -====== - -You probably already know about the lightweight Markdown markup language. Refer to our [Markdown guide][1], if you're new to the concept. Overall, it is a simple and effective language for creating plain-text documents. - -However, Markdown may not be enough to make detailed reports or technical documents. - -Hence, **R Markdown** as an **interactive file format** came into existence back in 2014 thanks to packages like [knitr][2] and [Pandoc][3]. It combines plain text with in-line R code, helping you make a dynamic document. - -To create R Markdown documents, you can use [various IDEs][4] and extensions to make it possible. However, the official IDE that helps you do it is **RStudio**. So, in this article, we will focus on **learning R Markdown syntax using RStudio**. - -💡 - -If you did not know, - -**R programming language** - - is used for statistical computing, graphics representation, and reporting. - -**Suggested Read 📖** - -How to Install and Use R on UbuntuBrief: This tutorial teaches you to install R on Ubuntu. You’ll also learn how to run your first R program in Ubuntu using various methods. R, together with Python, is the most commonly used programming language for statistical computing and graphics, making it easy to work with data. With![][5]It's FOSSSergiu![][6] - -### Setting RStudio - -RStudio makes it easy to work with R Markdown by its setup process. You just need to install a package, and you are done for the most part! - -Once you have RStudio installed, head to the Tools menu and select the _Install Packages_ option. - -![Select Install Packages option under Tools menu in RStudio][7] - -On the new dialog box, search for rmarkdown and install it. - -![Install RMarkdown Package by searching it and pressing install button on the new package install dialog box][8] - -💡 - -To use code chunks like python, you need to install additional packages. RStudio will prompt you to install the required packages when you try to include them in your document. - -Once installed, you can start a new rmarkdown document by selecting **File > New > RMarkdown**. - -![Create a new RMarkdown Document from File menu][9] - -This will prompt you to add some information regarding the document (metadata for the file). Fill those up. - -![Provide the title and other details for new document in rmarkdown][10] - -Or you can create an empty document to start fresh. - -### RMarkdown Syntax - -Since it is just "**enhanced Markdown**," most syntax remains the same. - -There would be some differences when you add things not usually supported with Markdown, like **tables, math equations, code chunks, etc.** - -Here's a quick summary of what we will be covering: - -Name of the RMarkdown BlockProper Syntax | -| Heading | # Level 1## Level 2### Level 3Level 1=======Level 2------- | -| Emphasis | *Italics*_Italics_**Bold**__Bold__ | -| List | Unordered List* Item* Item + Sub + SubOrdered List1. Item2. Item + Sub + Sub | -| Code Chunk | Normal Code Block```Code Goes Here```R Code Block```{r}R CODE```You can use other languages also.Inline `code` | -| Links | Plain Link: Paste the URLLink with Caption: [Text](URL_Address)Link to a section: [Text](#Name-of-section) | -| Table | | Column | Column | Column || ------ | ------ | ------ || Item | Item | Item || Item | Item | Item | | -| Equations | In line Equations: $Equations$Display Equations: $$Equations$$ | -| Images | Without Caption: With Caption :  | -| Block Quotes | > Type your Block Quotes | -| Misc | Super Script : Text^Superscript^Horizontal rule or Page Break:========= or ----------For Manual Line break, end line with 2+ spaces | - -#### The YAML Header - -At the top of a Rmarkdown document, there is a YAML header enclosed within two `---`. This block usually contains a title, author, date, and the file type you want to output, defining the **final look of the document.** - -The file type is either **HTML, PDF, or Word.** - -``` ---- -title: "Sample" -author: "It's FOSS" -date: "2023-02-08" -output: pdf_document ---- -``` - -This can be added while setting the new document in RStudio, which is shown in the above section. - -#### Heading - -In R Markdown, we can give heading in two different methods. Either we can use the # character for different levels of heading like: - -``` -# Heading Level 1 -## Heading Level 2 -### Heading Level 3 -#### Heading Level 4 -##### Heading Level 5 -###### Heading Level 6 -``` - -Or, `=` and `-` for level 1 and 2 headings, respectively. - -``` -Level 1 Heading -=============== - -Level 2 Heading ---------------- -``` - -![various types of heading levels in rmarkdown file][11] - -#### Lists - -There are two types of Lists, the first one is an **Unordered list**, or you could call them bullet points: - -``` -* Item 1 -* Item 2 - + Sub 1 - + Sub 2 -* Item 3 -``` - -And the second one is the **Ordered list**, which is the numbered type: - -``` -1. Item 1 -2. Item 2 - + Sub 1 - + Sub 2 -3. Item 3 -``` - -![order and unordered list example][12] - -**Suggested Read 📖** - -Read and Organize Markdown Files in Linux Terminal With GlowGlow is a CLI tool that lets you render Markdown files in the Linux terminal. You can also organize Markdown files with it.![][13]It's FOSSAbhishek Prakash![][14] - -#### Format text within a paragraph - -There are several ways to format text. - -![][15] - -You can add emphasis to the text like italics or bold using: - -- Italics: Place the text in between single asterisks or single underscore -- Bold: Place the text in between double asterisks or double underscores. - -``` -*This is Italicized text* -_This is Italicized text_ - -**This is Bold Text** -__This is Bold Text__ -``` - -You can explore on this using our resource on [how to add bold and italic text in Markdown][16]. - -If you want to add superscript to a text, place the text that should be superscript in between `^` symbol. - -``` -Normal Text^super_script^ -``` - -Or, if you want to add text strike-through, place the text in between two `~~` symbol. - -``` -~Strike Through this~~ -``` - -![][17] - -#### Adding Code Chunks - -Embedding code is the primary purpose of R Markdown. It allows us to add codes in several ways. - -**Adding Normal code block.** - -If you want to add a normal code block to separate it from other text, use the syntax below: - -``` -``` -Your Code Goes Here -``` -``` - -You can also try [adding code blocks with syntax highlighting][18]. - -You should append the language in curly braces if you want to add code and embed its output to the document: - -``` -```{Language} -Your Code Goes Here -``` -``` - -Or, you can add inline codes by placing the respective text between ` symbols. - -``` -The `code` is a code -``` - -Here's how it should look like: - -![][19] - -#### Links - -To add a link as plain text, just paste the link as it is in a line. - -``` -https://itsfoss.com -``` - -Or, to make a text hyperlink, use the syntax: - -``` -[Text](URL Address) -``` - -Another way to add a link is, when you want to link to a section of the page. In this case, use the syntax: - -``` -[Text](#Name-of-section) -``` - -![][20] - -#### Tables - -The syntax for adding tables is similar to that of markdown. - -``` -|Column|Column|Column| -| --- | --- | --- | -|Item|Item|Item| -|Item|Item|Item| -``` - -![][21] - -📋 - -Curious to know more? Refer to our guide on - -[creating tables in Markdown][22] - -. - -#### Images - -To add an image, use the syntax: - -``` - - -OR - - -``` - -![][23] - -#### Block Quotes - -RMarkdown allows you to add block quotes. To use this, use the **> (greater than)** symbol in front of the line/paragraph you want to quote. - -``` -This is a normal text - -> This is a Block Quote -``` - -![][24] - -If you want to explore more use cases of blockquote, head to our [Markdown quotes][25] guide. - -#### Equations - -Using RMarkdown, you can add either equations or display complex LaTex equations. - -For example: - -``` -In line Pythagorean Theorem: $Equation$ - -Display Equation: $$Equation$$ -``` - -![adding equations in R Markdown document][26] - -#### Horizontal Rule / Page Break - -Use three or more asterisks or dashes to add a horizontal rule /page break. - -``` -************ - ------------- -``` - -If you want to add a manual line break, end that line with two or more spaces. - -### Summary - -### R Markdown is Useful (Cheat Sheet) - -Whether you are working with scientific reports or want to create any other type of dynamic document, R Markdown is your best bet to make the most out of Markdown. - -Here's a cheat sheet to help you summarize it all: - -![][27] - -[R Markdown Cheat SheetR Markdown Cheat Sheet.pdf145 KBdownload-circle][28] - -_💬 Did we miss something that you use with R Markdown? Share your thoughts in the comments down below._ - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/r-markdown/ - -作者:[Sreenath][a] -选题:[lkxed][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/sreenath/ -[b]: https://github.com/lkxed/ -[1]: https://itsfoss.com/markdown-guide/ -[2]: https://www.r-project.org/nosvn/pandoc/knitr.html -[3]: https://itsfoss.comknitr, and Pandoc -[4]: https://itsfoss.com/best-modern-open-source-code-editors-for-linux/ -[5]: https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png -[6]: https://itsfoss.com/content/images/wordpress/2019/06/install-r-on-ubuntu.jpg -[7]: https://itsfoss.com/content/images/2023/02/select-install-packages.png -[8]: https://itsfoss.com/content/images/2023/02/install-rmarkdown-1.png -[9]: https://itsfoss.com/content/images/2023/02/new-r-markdown.png -[10]: https://itsfoss.com/content/images/2023/02/new-document-in-rmark.png -[11]: https://itsfoss.com/content/images/2023/02/Headings.png -[12]: https://itsfoss.com/content/images/2023/02/List.png -[13]: https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png -[14]: https://itsfoss.com/content/images/wordpress/2022/01/glow-cli-markdown.png -[15]: https://itsfoss.com/content/images/2023/02/emphasis.png -[16]: https://itsfoss.com/markdown-bold-italic/ -[17]: https://itsfoss.com/content/images/2023/02/superescript.png -[18]: https://itsfoss.com/markdown-code-block/ -[19]: https://itsfoss.com/content/images/2023/02/code-chunk.png -[20]: https://itsfoss.com/content/images/2023/02/links.png -[21]: https://itsfoss.com/content/images/2023/02/table.png -[22]: https://itsfoss.com/markdown-table/ -[23]: https://itsfoss.com/content/images/2023/02/images.png -[24]: https://itsfoss.com/content/images/2023/02/block-quotes.png -[25]: https://itsfoss.com/markdown-quotes/ -[26]: https://itsfoss.com/content/images/2023/02/equations.png -[27]: https://itsfoss.com/content/images/2023/02/R-Markdown-Cheat-Sheet.webp -[28]: https://itsfoss.com/content/files/2023/02/R-Markdown-Cheat-Sheet.pdf diff --git a/translated/tech/20230216.1 ⭐️⭐️ Beginner's Guide to R Markdown Syntax [With Cheat Sheet].md b/translated/tech/20230216.1 ⭐️⭐️ Beginner's Guide to R Markdown Syntax [With Cheat Sheet].md new file mode 100644 index 0000000000..9eee713699 --- /dev/null +++ b/translated/tech/20230216.1 ⭐️⭐️ Beginner's Guide to R Markdown Syntax [With Cheat Sheet].md @@ -0,0 +1,409 @@ +[#]: subject: "Beginner's Guide to R Markdown Syntax [With Cheat Sheet]" +[#]: via: "https://itsfoss.com/r-markdown/" +[#]: author: "Sreenath https://itsfoss.com/author/sreenath/" +[#]: collector: "lkxed" +[#]: translator: "lxbwolf" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " + +R Markdown 语法新手指南[备忘录] +====== + +你可能已经了解过轻量级标记语言 Markdown。如果你是第一次接触这个概念,请参考我们的 [Markdown 指南][1]。概括来讲,它是一种用于创建纯文本文档的简单又高效的语言。 + +然而,Markdown 在制作详细的报告或技术文件方面可能还不够完善。 + +受益于[knitr][2]和[Pandoc][3]等软件包,**交互式文件格式 R Markdown** 早在 2014 年就出现了。它将纯文本与内嵌的 R 代码相结合,可以制作动态文件。 + +你可以使用 [各种 IDE][4] 和扩展来创建 R Markdown 文档,官方 IDE 为**RStudio**。因此,在这篇文章中,我们将重点介绍**使用 RStudio 学习 R Markdown语法**。 + +💡 + +(假如你没有了解过,)**R 编程语言** 是一种用于统计计算、图形表示和报告的语言。 + +**推荐阅读 📖** + +是一种用于统计计算、图形表示和报告的语言。 + +**建议阅读 📖** + +如何在 Ubuntu 上安装和使用 R。 +概要:本教程教你如何在 Ubuntu上安装 R。你还将学习在 Ubuntu 上运行你的第一个 R 程序的各种方法。R 和 Python 都是最常用的统计计算和图形的编程语言,能让数据处理变得简单。 +![][5] +![][6] + +### 配置 RStudio + +通过合适的配置,你可以很轻松地用 RStudio 来编写 R Markdown。当你安装完一个软件包后,就已经完成了大部分的工作! + +安装 RStudio 后,在**工具**菜单中选择_安装软件包_选项。 + +![在 RStudio 的工具菜单下选择安装软件包选项][7] 。 + +在弹出的对话框中,搜索 rmarkdown 并安装。 + +![通过搜索并在新的软件包安装对话框中按下安装按钮来安装 Rmarkdown 软件包][8] + +💡 + +如果你想使用类似 python 的代码块,你需要安装额外的包。当你想在你的文档中包含这些包时,RStudio 会提示你安装所需的包。 + +安装完成后,你可以通过选择**文件>新建>RMarkdown** 来新建一个 rmarkdown 文档。 + +![从文件菜单中创建一个新的 RMarkdown 文档][9] 。 + +之后会提示你添加一些关于文件的信息(文件的元数据),把这些填上就可以了。 + +![用 rmarkdown 语法写出标题和其他细节][10] + +或者你可以创建一个空的文件从零开始。 + +### RMarkdown 语法 + +由于它是"加强版的 Markdown",因此大多数语法与 markdown 是一样的。 + +它还有一些 Markdown 支持不完善的东西,比如**表格、数学方程式、代码块等等**。 + +下面是我们要介绍的内容的概括。 + +
RMarkdown 块名 | +语法 | +
---|---|
标题 | +# 一级标题 ## 二级标题 ### 三级标题 一级标题 ======= 二级标题 ------- |
+
着重 | +*斜体* _斜体_ **加粗** __加粗__ |
+
列表 | +无序列表 * 列表项 * 列表项 + 子项 + 子项 有序列表 1. 列表项 2. 列表项 + 子项 + 子项 |
+
代码块 | +普通代码块 ``` 这里写代码 ``` R 代码块 ```{r} R 代码 ``` 你也可以用其他的语言 行内 `代码` |
+
链接 | +纯文本:粘贴 URL 带标题的链接:[显示的文本](URL_地址) 跳转到锚点[显示的文本](#锚点) |
+
表格 | +| 列名 | 列名 | 列名 | | ------ | ------ | ------ | | 项内容 | 项内容 | 项内容 | | 项内容 | 项内容 | 项内容 | |
+
方程式 | +行内方程式 \$Equations\$ 展示方程式: \$\$Equations\$\$ |
+
图片 | +无标题:  有标题:  |
+
引用块 | +> 输入你引用的内容 | +
其他 | +上角标:文本内容^上角标^ 章或页水平分割线 ========= 或 ---------- 行尾输入两个以上空格,即可添加人工行分割 |
+