I am working on a simple dashboard with using R, Shiny, Flexdashboard and Leaflet. The code itself seems to work fine. However I am facing some issues to deploy it.
When I run/Knit the document for the first time everytyhing seems ok, but if I try to publish it I receive this message when I hit the 'Publish' button above the rendered document:
'Only rendered R Markdown documents can be published to RPubs. To
publish this document, click Knit to render it, then click the Publish
button above the rendered document'
Then, if I reload the page or Knit the document again without make any change, the tables and the maps disappears.
Initially, I thought it was something with Leaflet, but I got the same behavior with this minimal and reproducible example both in R Studio and R Studio Cloud.
---
title: "Example"
output:
flexdashboard::flex_dashboard:
orientation: columns
runtime: shiny
---
```{r }
library(flexdashboard)
library(shiny)
library(DT)
# OPERAÇÃO POR BAIRROS
link = "https://docs.google.com/spreadsheets/d/e/2PACX-1vS3cj3PhVm-2F-CiEJOE8O1YIIU6t7os_wDDrACFne39ZRUvxLKdV_MKZNzD6xTG0hoI5ZroHpxyIzV/pub?output=csv"
df_op = read.csv(link)
```
Column {data-width=350}
-----------------------------------------------------------------------
### Table
```{r table}
df_table = reactive({
df_op
})
DT::renderDataTable(df_table())
```
To solve the blank element issue, the line
runtime:shiny
must be written from the first column, just as described bellow.
title: "Example"
output:
flexdashboard::flex_dashboard:
orientation: columns
runtime: shiny
Related
I have built a Shiny app through Flexdashboard and I'm having an isssue which I am incapable of solving. I embeded a local PDF file using this code (minimal reproducible example, remove the '##' but not the '###' to test it with any pdf you have):
---
title: "Random Title"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
social: menu
runtime: shiny
---
## ```{r setup, include=FALSE}
library(flexdashboard)
library(shiny)
## ```
PDF
=====================================
### CV
## ```{r}
tags$iframe(style = "height:850px; width:100%; scrolling=yes", src = "randomPDF.pdf")
## ```
My problem is that when I run the App, it opens two tabs: one with the Shiny App (with the PDF well embeded, which is nice) but also a new tab only with the pdf. I want this to stop happening, and I'm struggling to achieve it.
I have created an Rmarkdown file in a Kaggle Kernel and I am trying to do the following:
1) Set some code chunks as hidden but with a button next to them to allow the viewer to hide or display the code
2) Set some other codes chunks as not hidden with again a buttopn next to them to allow the viewer to hide or display the code
From what I could see in previous questions a suggested solution is
---
title: "test"
output:
html_document:
code_folding: hide
---
That unfortunately is not working for me. I have also set the following in the start of my script
```{r setup, include=FALSE, echo=FALSE}
knitr::opts_chunk$set(echo= TRUE)
and before each code I have the following:
```{r, message = FALSE, warning=FALSE }
# Load packages
library("ggplot2")
library("pastecs")
library("dplyr")
library("corrplot")
So my question would be, what should I do to get 1) and 2)?
Thanks in advance.
I want to use ionicons icons when building a dashboard with flexdashboard.
From documentation ( https://rmarkdown.rstudio.com/flexdashboard/using.html#icon-sets )an example:
“ion-social-twitter”
When i search for same icon in iconicons website ( https://ionicons.com/ ) I get
<ion-icon name="logo-twitter"></ion-icon>
If in my R code I insert "ion-logo-twitter" it doesn't work. What's the correct name for icons of this website? Thanks
I had a similar icon issue with my R Markdown site. The explanation is that R Markdown is operating with an outdated version of ionicons (v2), which uses a different naming convention.
If you use the v2 ionicon names, found at https://ionicons.com/v2/cheatsheet.html, it should solve your problem.
A little hard to tell without more code, but the following should work:
---
title: "Column Orientation"
output: flexdashboard::flex_dashboard
---
```{r setup, include=FALSE}
library(flexdashboard)
```
Column
-------------------------------------
### Chart 1
```{r}
valueBox(42, icon = "ion-social-twitter")
```
Column
-------------------------------------
### Chart 2
```{r}
```
### Chart 3
```{r}
The documentation of the new learnr-package states that
it’s also possible to add other forms of interactivity using Shiny (e.g. for teaching a statistical concept interactively).
I tried it with the provided example but I could not manage it. The slider does appear but not the plot. I used:
---
title: "Tutorial"
output:
learnr::tutorial:
progressive: true
allow_skip: true
runtime: shiny_prerendered
tutorial:
version: 0.1
---
```{r setup, include=FALSE}
library(learnr)
library(checkr)
library(shiny)
knitr::opts_chunk$set(exercise.checker = checkr::checkr_tutor)
```
The example did work with
---
title: "R Notebook"
output: html_notebook
runtime: shiny
---
I tracked the problem down: It was completely my own fault. I used the same name for the input variable in another R chunk with shiny code.
I did not get any error message, the output just did not show up.
I am exploring the use of DT:datatable in an interactive document using Rmarkdown and shiny (I have not used datatable before).
I am able to create a document that plots a data table:
---
title: "Test DT"
output: html_document
runtime: shiny
---
```{r echo=FALSE}
datatable(iris)
```
Clicking in a row in the datatable highlights a row. Is there any way to access the selected rows without implementing a shiny server? How?
You have to use an output$id for it to work. Just how you would do it in shiny itself
---
title: "Test DT"
output: html_document
runtime: shiny
---
```{r echo=FALSE}
library(DT)
DT::dataTableOutput('irisTable')
output$irisTable = DT::renderDataTable(iris, selection = 'multiple')
p("By default DT allows multiple row selection. Selected rows are...")
renderPrint(input$irisTable_rows_selected)
```
DT also allows column and cell selection as well as preselection. See documentation