Hi, I'm quite new to R and Shiny and I'm trying to figure out how I can put the data of a CSV file into a matrix.
What I have now is this:
library(shiny)
# Define UI
ui <- fluidPage(
titlePanel("Insole Data Analyzer"),
fluidRow(
column(width = 6,
dataTableOutput('mytable1'),
fileInput('file1', 'Left foot data',
accept = c(
'text/csv',
'text/comma-separated-values',
'text/tab-separated-values',
'text/plain',
'.csv',
'.tsv'
)
)
),
column(width = 6,
dataTableOutput('mytable2'),
fileInput('file2', 'Right foot data',
accept = c(
'text/csv',
'text/comma-separated-values',
'text/tab-separated-values',
'text/plain',
'.csv',
'.tsv'
)
)
)
),
fluidRow(
column(width = 6,
tableOutput("tb1")
),
column(width = 6,
tableOutput("tb2")
)
)
)
# Define Server
server <- function(input,output){
output$tb1 <-renderTable({
data1 <- input$file1
if(is.null(data1)){return()}
read.table(data1$datapath,sep="")
})
output$tb2 <-renderTable({
data2 <- input$file2
if(is.null(data2)){return()}
read.table(data2$datapath,sep="")
})
}
# Run Shiny app ----
shinyApp(ui = ui, server = server)
This gives me two "browse file" buttons to insert my CSV files and it immediately plots the table.
Instead of this, I want to use the data of the table to do some calculations on.
How can I create a matrix of this table and loop over each row to check this data and alter the matrix?