Change line inside shiny::renderText() used in flexdashboard - r

I have the basic flexdashboard below. What I want is to change line after "hello" in order to place "world" below it,inside the renderText(). I have found that I can use htmlOutput() and verbatimTextOutput() but these are not used in flexdashboard.
---
title: "[School Name] Enrollment Projections for Fall 2019"
output:
flexdashboard::flex_dashboard:
orientation: rows
runtime: shiny
---
```{r setup, include = FALSE}
library(flexdashboard)
library(shiny)
```
Column {.sidebar }
-------------------------------------
### Menu
```{r}
renderText({
paste("hello", "world", sep="\n")
})
```
Row {data-height=400}
-------------------------------------
### Enrollments
```{r}
```

Related

remove text post clicking the button

below is my reprex. Post clicking the upload button, the text appears. Upon clicking the clear button the text should go off. Wanted to check the way to do this. Can anyone help me here
---
title: "Untitled"
runtime : shiny
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
code <- "This is code"
```
Column {data-width=650}
-----------------------------------------------------------------------
### Chart A
```{r}
actionButton("upload","Upload",width = 150)
actionButton("clear_upload","Clear",width = 150)
verbatimTextOutput("code")
get_code <- eventReactive(input$upload,{
code
})
output$code <- renderPrint(
get_code()
)
```
If I've correctly understood your problem, you may use the the observeEvent statement:
---
title: "Untitled"
runtime : shiny
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
code <- "This is code"
```
Column {data-width=650}
-----------------------------------------------------------------------
### Chart A
```{r}
actionButton("upload","Upload",width = 150)
actionButton("clear_upload","Clear",width = 150)
verbatimTextOutput("code")
get_code <- eventReactive(input$upload,{
code
})
observeEvent(input$upload, {output$code <- renderPrint(get_code())})
observeEvent(input$clear_upload, {output$code <- renderPrint("")})
```

Can we create a multiple filters/drop downs in DT

I have a simple app. I have got both date and time in a column. So can we create multiple filters/Dropdowns for this column A
---
title: "Untitled"
runtime: shiny
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
```
Column {data-width=650}
-----------------------------------------------------------------------
### Chart A
```{r}
df <- data.frame(A=c("2018-01-01 06:06:06","2018-01-02 06:06:01"),B=c("A","B"))
DT::dataTableOutput('a')
output$a <- DT::renderDataTable(
df)
```

align text side by side to figure

How can I put the figure on left and text on right and align it left (the text)?
---
title: "Untitled"
author: "George"
date: "12/3/2018"
output:
flexdashboard::flex_dashboard:
orientation: rows
runtime: shiny
---
```{r global, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(flexdashboard)
library(dplyr)
library(GGally)
x <- c(1,2,3)
y <- c(11,22,33)
z <- data.frame(x, y)
```
Introduction
=======================================================================
### General info
- A
- B
Corr
=======================================================================
### Correlation
Here is some text
- One
- Two
```{r}
renderPlot({
GGally::ggpairs(z)
})
```
try this, this layout fills the page completely and gives prominence to a single chart on the left where you can have your img and two secondary charts included to the right- where you can have your text
title: "Focal Chart (Left)"
output: flexdashboard::flex_dashboard
---
Column {data-width=600}
-------------------------------------
### Chart 1
```{r}
```
Column {data-width=400}
-------------------------------------
### Chart 2
```{r}
```
### Chart 3
```{r}
```

Include table of contents in flexdashboard

I would like to include a table of contents in my flexdashboard document.
Exactly like the table of contents we can see in the documentation : http://rmarkdown.rstudio.com/flexdashboard/using.html
I have tried to add toc:true as in a classical RMarkdown document but it does not seem to work.
---
title: "Reporting"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: scroll
toc: true
---
# Page1
Row
-----------------------------------------------------------------------
## chap1
### chart 1
```{r cars1, echo=FALSE}
plot(pressure)
```
### chart 2
```{r cars2, echo=FALSE}
plot(pressure)
```
Row
-----------------------------------------------------------------------
## chap2
### chart 3
```{r pressure, echo=FALSE}
plot(pressure)
```
# Page 2
Row
-----------------------------------------------------------------------
### p2 chap 1
```{r test}
plot(pressure)
```
Row
-----------------------------------------------------------------------
### p2 graph2
```{r test2, echo=FALSE}
plot(pressure)
```
In this example, I would like to see in Page 1 a table of contents containing two lines : chap1 and chap2. In Page 2 I don't need a table of contents.
How can I do that ?
Thank you.

Conditional reactive logic shiny based flexdashboard

I am trying to contiditonally do either one type of render (renderPlot) or another (renderText) based on some input. Here's what I tried:
---
title: "Citation Extraction"
output:
flexdashboard::flex_dashboard:
vertical_layout: scroll
orientation: rows
social: menu
source_code: embed
runtime: shiny
---
```{r setup, include=FALSE}
library(flexdashboard)
library(shiny)
```
Sidebar {.sidebar}
=====================================
```{r}
textInput("txt", "What's up?:")
```
Page 1
=====================================
### Chart A
```{r}
urtxt <- reactive({input$txt})
if (nchar(urtxt()) > 20){
renderPlot({plot(1:10, 1:10)})
} else {
renderPrint({
urtxt()
})
}
```
But it states:
So I tried adding a reactive around the conditional resulting in returning the function reactive returns.
reactive({
if (nchar(urtxt()) > 20){
renderPlot({plot(1:10, 1:10)})
} else {
renderPrint({
urtxt()
})
}
})
How can I have conditional reactive logic?
To get different kind of output depending on the length of the inputed character string you can do following:
1) Create a dynamic output uiOutput,
2) In the reactive environment renderUI, depending on the input, choose kind of the output.
3) Render the output
---
title: "Citation Extraction"
output:
flexdashboard::flex_dashboard:
vertical_layout: scroll
orientation: rows
social: menu
source_code: embed
runtime: shiny
---
```{r setup, include=FALSE}
library(flexdashboard)
library(shiny)
```
Sidebar {.sidebar}
=====================================
```{r, echo = F}
textInput("txt", "What's up?:", value = "")
```
Page 1
=====================================
### Chart A
```{r, echo = F}
uiOutput("dynamic")
output$dynamic <- renderUI({
if (nchar(input$txt) > 20) plotOutput("plot")
else textOutput("text")
})
output$plot <- renderPlot({ plot(1:10, 1:10) })
output$text <- renderText({ input$txt })
```

Resources