This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Uploading text file or any file format in Flexdashboad

Hello , using flexdashboard i can upload and visualize csv file but when i upload text file or any other file it is showing csv output and when i select radio button as text or tab file is not showing in output can anyone help how to see any format file using flexdashboard.

Below is my code :


title: "Data-upload" output: flexdashboard::flex_dashboard: orientation: rows vertical_layout: fill

runtime: shiny

```{r setup, include=FALSE} library(flexdashboard) library(shiny) library(tidyverse) library(DT) library(ggplot2) library(ggridges)



Data{}
======================================================================

sidebar{.sidebar}
----------------------------------------------------------------------
*Data - Upload*

```{r}
fileInput('file1', 'Choose CSV File',
                accept=c('text/csv', 
                         'text/comma-separated-values,text/plain', 
                         '.csv','.tsv'))
checkboxInput('header', 'Header', TRUE)  
radioButtons('sep', 'Separator',
                   c(Comma=',',
                     Semicolon=';',
                     Tab='\t', Text=".txt", Excel=".xls")
              )
radioButtons('quote', 'Quote',
                   c(None='',
                     'Double Quote'='"',
                     'Single Quote'="'"),
                   '"')


data read

```{r} data <- reactive({ req(input$file1) ## ?req # require that the input is available

inFile <- input$file1 

# tested with a following dataset: write.csv(mtcars, "mtcars.csv")
# and                              write.csv(iris, "iris.csv")
df <- read.csv(inFile$datapath, header = input$header, sep = input$sep, quote = input$quote)
return(df)

}) ```

{r} renderTable({ data = data() data })

output i am getting as:

PeakID.Chr.Start.End.Strand.Peak_Score diff_c1_vs_c2_cond2_4chr15 2039728520397423+22.0568 diff_c1_vs_c2_cond2_2chr13 8394774283947861+20.9595 diff_c1_vs_c2_cond2_3chr14 6023168660231805+20.412

PeakID.Chr.Start.End.Strand.Peak_Score

diff_c1_vs_c2_cond2_4chr15 2039728520397423+22.0568 diff_c1_vs_c2_cond2_2chr13 8394774283947861+20.9595 diff_c1_vs_c2_cond2_3chr14 6023168660231805+20.412

r

Hei could you please try to format code.


title: "Data-upload" output: flexdashboard::flex_dashboard: orientation: rows vertical_layout: fill

runtime: shiny

```{r setup, include=FALSE} library(flexdashboard) library(shiny) library(tidyverse) library(DT) library(ggplot2) library(ggridges)



Data{}
======================================================================

sidebar{.sidebar}
----------------------------------------------------------------------
*Data - Upload*

```{r}
fileInput('file1', 'Choose CSV File',
                accept=c('text/csv', 
                         'text/comma-separated-values,text/plain', 
                         '.csv','.tsv'))
checkboxInput('header', 'Header', TRUE)  
radioButtons('sep', 'Separator',
                   c(Comma=',',
                     Semicolon=';',
                     Tab='\t', Text=".txt", Excel=".xls")
              )
radioButtons('quote', 'Quote',
                   c(None='',
                     'Double Quote'='"',
                     'Single Quote'="'"),
                   '"')


data read

```{r} data <- reactive({ req(input$file1) ## ?req # require that the input is available

inFile <- input$file1 

# tested with a following dataset: write.csv(mtcars, "mtcars.csv")
# and                              write.csv(iris, "iris.csv")
df <- read.csv(inFile$datapath, header = input$header, sep = input$sep, quote = input$quote)
return(df)

}) ```

{r} renderTable({ data = data() data })

I dont know how to format, i have pasted code from r markdown (code is running perfectly , only thing is other file formats except csv are not showing out put

0 answers

No answers yet.

Log in to answer this question.