I am new to R markdown. My title for the dashboard is big. I want it to appear like this:
Uber data analysis
(NYC, April 2014 - September 2014)
As of now, it comes out in one line like in the image below:
Please let me know how to fix this. Thanks
I don't know why this isn't easier. A way to hack it is to use the author YAML input as the subtitle and use some css to rearrange the title. If you run the following Rmarkdown file, you should see the title now on two lines.
---
title: "Uber data analysis"
author: "(NYC, April 2014 - September 2014)"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
---
<style>
.navbar-brand {
display: grid;
margin: auto;
padding: 5px;
}
.navbar-author {
margin-left: 0px;
}
</style>
```{r setup, include=FALSE}
library(flexdashboard)
```
Highlights
========================================
Column
-----------------------------------------------------------------------
### Chart A
```{r}
```
Related
When using the cleanrmd package for R Markdown, the output html page is left-aligned if I specify the theme to use, while it's centered when the them is set as NULL.
theme set as NULL
---
title: "TEST"
output:
cleanrmd::html_document_clean:
theme: NULL
---
With a theme specified
---
title: "TEST"
output:
cleanrmd::html_document_clean:
theme: new.css
---
Anyone can help me to fix this?
Specify CSS rule body { margin: 0 auto; padding: 2rem;} for the entire body of the document, which will fix the issue.
---
title: "Title"
author: "Author"
date: "Date"
output:
cleanrmd::html_document_clean:
theme: new.css
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{css, echo = FALSE}
body {
margin: 0 auto;
max-width: 750px;
padding: 2rem;
}
```
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax
for authoring HTML, PDF, and MS Word documents. For more details on
using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that
includes both content as well as the output of any embedded R code
chunks within the document.
Rendered output looks like,
This is my Rmarkdown code:
---
title: "Tutorial"
output:learnr::tutorial:
code_folding: hide
runtime: shiny_prerendered
---
```{r setup}
library(learnr)
knitr::opts_chunk$set(echo = FALSE)
```
## Topic 1
### Exercise
*Here's a simple exercise with an empty code chunk provided for entering the answer.*
Write the R code required to add two plus two:
```{r two-plus-two, exercise=TRUE}
library(tidyverse)
mtcars %>% select(cyl, mpg)
```
### Exercise with Code
*Here's an exercise with some prepopulated code as well as `exercise.lines = 5` to provide a bit more initial room to work.*
Now write a function that adds any two numbers and then call it:
```{r add-function, exercise=TRUE, exercise.lines = 5}
add <- function() {
}
```
I already tried all the identation options , but its not working. Any help?
As seems, code-folding option doesn't work for output "learnr".
For html_doc - yes. F.e.:
output:
html_document:
code_folding: hide
But you can try next solution with details:
CSS:
<style>
details {
border: 1px solid;
border-radius: 10px;
padding: .1em .5em 0;
text-align: right;
}
</style>
Using:
<details>
<summary>Show/hide code</summary>
```{r two-plus-two, exercise=TRUE}
library(tidyverse)
mtcars %>% select(cyl, mpg)
```
</details>
Output:
P.S. If you need a support to IE/Edge - look there
I have the following RMarkdown FlexDashboard document:
---
title: "Some title"
runtime: shiny
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
```
Column {data-width=650}
-----------------------------------------------------------------------
### Some chart
```{r}
plot(faithful)
```
Column {data-width=650}
-----------------------------------------------------------------------
### Chart 2
```{r}
```
### Chart 3
```{r}
```
How can I put the footer that span across the page with the following content?
tags$div( HTML("<footer><small>© Copyright 2017, MyCompany Co.,Ltd</small></footer>"))
You can put the HTML of your footer in a footer.html file and include it after the body of your flexdashboard using after_body in your markdown:
---
title: "Some title"
runtime: shiny
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
includes:
after_body: footer.html
---
You can try this:
tags$footer( HTML("<footer><small><b>© Manoj Kumar 2021.</b></small></footer>"), align="left", style="position:absolute; bottom:0; width:95%; height:50px; color: #000000; padding: 0px; background-color: transparent; z-index: 1000;")
I'm using flexdashboard to create reports and I want to change a font size only for one part of the page.
It feels to me that I can do it by adding CSS class, but I can't find how can I specify class name in R markdown code.
Any ideas?
You can add CSS directly into your Rmarkdown document. For example, if you wanted to change the font of objects with class "chart-title" you could insert the following into your R markdown file:
---
title: "Title"
output:
flexdashboard::flex_dashboard:
theme: readable
orientation: columns
vertical_layout: fill
---
<style type="text/css">
.chart-title { /* chart_title */
font-size: 30px;
font-family: Algerian;
</style>
you can do something like this on individual items:
Column {data-width=400}
-----------------------------------------------------------------------
### <b><font face="Georgia" size="2em" color="#000000">Chart B</font></b>
Flexdashboard automatically add an id with the same name as the section title to that section. For example if you have a section "my plot", the id for that section will be "my-plot". You can add section-specific css as following
---
title: "Title"
output:
flexdashboard::flex_dashboard:
theme: readable
orientation: columns
vertical_layout: fill
---
Row
-----------------------------------------------------------------------
### my plot
plot1
### my plot2
plot2
<style type="text/css">
#my-plot .chart-title{
font-size: 20px;
}
<style type="text/css">
In the above example, only the font size of the plot 1 will be changed.
In knitr I want to add a (small) data frame as a table using the kable package:
---
output: html_document
---
```{r}
knitr::kable(mtcars[1:5,1:5], format="html")
```
This returns a compact table as above, while changing it to format="markdown"returns a nice table but spanning the whole page:
I have found the knitr manual but it does not cover the extra formatting options for each format. How can I change the size of a knitr table or even better, where can I get this information from?
The general approach would be to use your own custom CSS and include that in the YAML at the start of the document.
You can actually sort of do this from within your document, but I would suggest editing your CSS outside of the document and working from there.
Here's a minimal example:
---
title: "Test"
date: "24 October 2015"
output:
html_document:
css: mystyle.css
---
```{r, results='asis'}
writeLines("td, th { padding : 6px } th { background-color : brown ; color : white; border : 1px solid white; } td { color : brown ; border : 1px solid brown }", con = "mystyle.css")
dset1 <- head(ToothGrowth)
knitr::kable(dset1, format = "html")
```
This should:
Create a file named "mystyle.css" with your relevant CSS styling.
Produce something that looks something like the following.