Uploading text file or any file format in Flexdashboad
0
0
Entering edit mode
3.1 years ago
majeedmj.ict ▴ 20

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 • 1.7k views
ADD COMMENT
0
Entering edit mode

Hei could you please try to format code.

ADD REPLY
0
Entering edit mode

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 })

ADD REPLY
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 1665 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6