FAQ: How to make your code look nice? Markdown Formatting


#1

Jump to Contents


Code Chunks

You type in community:

``` r
 #> A code chunk   
 library(foo)
```

You get:

    #> A code chunk   
    library(foo)
  • This is easier to read.
  • It also creates a clear chunk of code for others can copy and paste into their own R environment.

Inline Code

Type this:

I really wanted you to see `this_code_here`

See this:

I really wanted you to see this_code_here


Quote Snippets

If you highlight the content and click quote it will automatically populate the reply with the formatted code:

[quote="stephhazlitt, post:5, topic:6246, full:true"]
How do you insert a quote from the thread above (or elsewhere) that appears as a nicely formatted indented box in a reply?
[/quote]

You can also select text and click the quote button (highlighted below):

Using > also works:

This is a quote.

from ⇩

> This is a quote.

Hide/Show Folding Spoilers

Example text of what's shown - click to see what's hidden

Example spoiler text

[details = Example text of what's shown - click to see what's hidden]
Example spoiler text
[/details]

Pixelate Spoiler Hider

There is and images below that will be pixelated until you click on it.

[spoiler]
```
print("Joe Cheng is photogenic")

```
![image|256x250](upload://2ZcnTcOclyi2ErordryDHkhojWL.jpg)
[/spoiler]

Will appear as:

print("Joe Cheng is photogenic")


More Markdown Formatting Tips

For more markdown formatting options - including bold, italics, tables, etc. http://commonmark.org/help/
image



Add a Zoom on my plot
System call within R shiny
Shiny app r Programming
Create plots using multpile dataframes
If/Else logic for fixing ZipCodes
How to give admininstrative rights while running R script from terminal in Linux?
Need help in shiny apps for disable shiny main apps window or disable the close button
Maptile fetched in RStudio Desktop but not RStudio Server
R : dynamic plot value and x axis value for line chart
Error sourcing while creating Shiny app
How to upgrade a package when using packrat
How to Ignore one of the factors in a Column
Document term matrix in XGBoost classifier
Connecting To A SQL Server
Create Volcano Plot
How to save SAS data into RData format
Checking is.null in a case_when statement
Problem with source_python using pulp in Windows
Suddelny, base solve function does not work on RStudio
Error during deploy shiny app
Multi-column-type Summarise
Curl error 18 occurred
Error in file.choose() file choice cancelled
Ggplot troubleshoot: Error: Aesthetics must be either length 1 or the same as the data (24): x, y, fill
Problem in 'matplot' function
Displaying information on click in timevis.r
Help with function convert.inp in RMark
“edit” and “read.table” on R for Mac
Fatal Error when running Keras/Tensorflow with GPU
Graph with errobar using percentile function
Error in gzfile(path.expand(tarfile), "rb") : cannot open the connection In addition: Warning message: In gzfile(path.expand(tarfile), "rb") : cannot open compressed file 'NA', probable reason 'Permission denied'
Error Preventing Knitting
How to average/mean variables in R based on the level of another variable (and save this as a new variable)?
How to customise colours to specific things
Cannot export a raster image after using the random forest classification
Error: cannot find function trim
Show matched and unmatched results from vector in data table
Ggplot adding points in large dataset, looks terrible
FAQ: What's a reproducible example (`reprex`) and how do I do one?
Problem with Histogram
Using www folder: Save and display pdf
Track down error in R
Problems with loading ggplot2
Can I put the result of read.files in a list and iterate through the list to match specific files
Package ‘dplyr’ is not available (for R version 3.4.3)
Improve the speed
Changing Base R code to dplyr/sparklyr
Chapter starts with 0.1 (not 1.0) in pdf_book format
R Studio crashes when connecting to Spark with sparklyr
Sparklyr 's error
Error when trying to use corrplot
#3

#4

#5

How do you insert a quote from the thread above (or elsewhere) that appears as a nicely formatted indented box in a reply?


#6

If you highlight the content and click quote it will automatically populate the reply with the formatted code:

[quote="stephhazlitt, post:5, topic:6246, full:true"]
How do you insert a quote from the thread above (or elsewhere) that appears as a nicely formatted indented box in a reply?
[/quote]

You can also select text and click the quote button (highlighted below):

Using > also works:

This is a quote.

from ⇩

> This is a quote.

#8

2 posts were split to a new topic: How to make markdown tables?


#9

R Markdown Source

Use four backticks and the "markdown" syntax hint to surround the source of R Markdown documents:

Type this:

````markdown
---
title: "It's full of cars!"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents.

```{r cars}
summary(cars)
```
````

See this:

---
title: "It's full of cars!"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. 

```{r cars}
summary(cars)
```

Floating table of contents and plots produce extra whitespace at bottom