Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do you create a subsection in R markdown

Tags:

markdown

r

knitr

I am trying to create a R markdown like below. In a vector called app, I will have several application, will go though and create a pdf file

---
title: "Java Based Apps"
date: "January 13, 2017"
output: 
  pdf_document: 
    number_sections: yes
    toc: true
    highlight: zenburn
    fig_width: 7
    fig_height: 6
    fig_caption: true

tables: yes
keep_tex: true
fontsize: 12
---



```{r message=FALSE, results = 'asis', echo=FALSE, warning=FALSE}

app<-c("Sample APP")

for (i in app){

    cat(paste("## ", "- Correlation Analysis between performance KPI's"))
    cat("\n")
    m<-corrplot(M, method="number")

    cat(paste("## ", "- JVM %CPU Usage"))
    cat("\n")

    print(ggplot(data, aes(Date, JVM_CPU, group=JVM))+geom_point()+geom_smooth(method="lm",se=F)+theme_bw()+
    ggtitle(paste(i, " - JVM %CPU Usage/15 Minute Interval"))+facet_wrap(~JVM, scale="free"))

    cat(paste("## ", "- JVM Heap Usage"))
    cat("\n")

    print(ggplot(data, aes(Date, JVM_Mem, group=JVM))+geom_point()+geom_smooth(method="lm",se=F)+theme_bw()+
    ggtitle(paste(i, " - JVM Memory Usage/15 Minute Interval"))+facet_wrap(~JVM, scale="free")+ylab("Memory Usage/MG"))

 }
```

the output needs to be like this:

Sample App
   - Correlation Analysis between performance KPI's
   - JVM %CPU Usage
   - JVM Heap Usage

etc

I am seeing this:

Sample App
   - Correlation Analysis between performance KPI's

but others are not being created as subsections. Any idea what I am doing wrong here?

like image 344
user1471980 Avatar asked Jan 23 '17 20:01

user1471980


People also ask

How do you add a subscript in R Markdown?

To indicate a subscript, use the underscore _ character. To indicate a superscript, use a single caret character ^ . Note: this can be confusing, because the R Markdown language delimits superscripts with two carets.

How do I separate paragraphs in R Markdown?

To break a line in R Markdown and have it appear in your output, use two trailing spaces and then hit return .

What are the three types of sections in an R Markdown document select three options?

The following sections dive into the three components of an R Markdown document in more details: the markdown text, the code chunks, and the YAML header.

How do I create a Markdown in R?

To create an R Markdown report, open a plain text file and save it with the extension . Rmd. You can open a plain text file in your scripts editor by clicking File > New File > Text File in the RStudio toolbar. Be sure to save the file with the extension .


1 Answers

Add cat("\n\n") after each plot to add space. That should help make the ## work to separate the subsections properly.

like image 172
Ryan Morton Avatar answered Sep 22 '22 16:09

Ryan Morton