Closed calculus-ask closed 9 years ago
Tried using strsplit also..
library(shiny)
shinyServer(function(input, output, session) {
output$contents <- renderTable({
if (input$header== TRUE)
{
infile <- input$file1
if (is.null(input$file1)) {return(NULL)}
read.csv(infile$datapath)
}
else
{
infile <- input$file1
if (is.null(input$file1)) {return(NULL)}
tmp <- strsplit(input$value,",")
read.csv(infile$datapath,header=FALSE,col.names=tmp)
}
}) })
Error..
Error in read.table(file = file, header = header, sep = sep, quote = quote, : more columns than column names
Tried with renderUI also.. cant figure the error in this.. kindly help on this issue..
library(shiny)
shinyServer(function(input,output,session)
{
output$contents <- renderTable
({
if (input$header== TRUE)
{
infile <- input$file1
if (is.null(input$file1)) {return(NULL)}
heada <- read.csv(infile$datapath)
}
})
output$number <- renderUI ({ num <- as.integer(input$nums) textInput <- lapply(1:num, function(i) {textInput(paste("text_",i),paste("value",i),"")}) do.call(sidebarPanel,textInput) })
output$contenta <- renderTable ({ if (input$header==FALSE) { num <- as.integer(input$nums) infile <- input$file1 if (is.null(input$file1)) {return(NULL)} headb <- read.csv(infile$datapath,header=FALSE,col.names=c(lapply(1:num, function(i) {input[[paste("text_",i)]]}))) } }) })
library(shiny) shinyUI(fluidPage(
titlePanel("The Ace!"),
navbarPage("Calulus@Work",
tabPanel("About Tool"
),
navbarMenu("Data Load",
tabPanel("Delimter",
sidebarLayout(
sidebarPanel(fileInput('file1', 'Choose file to upload',
accept = c('text/csv',
'text/comma-separated-values',
'text/tab-separated-values',
'text/plain','.csv','.tsv'
)),
checkboxInput('header', 'Header', TRUE),
textInput("value","Enterhere","")
),
mainPanel(
tableOutput('contents'),
uiOutput('number'),
tableOutput('contenta')
))))
)#navbarPage
)#fluidpage )#shinyUI
Error in orig(name = name, shinysession = self) : unused arguments (name = name, shinysession = self)
With the second version of your code, it sounds like you simply have the wrong number of columns in the header text.
For more on debugging shiny apps, see http://shiny.rstudio.com/articles/debugging.html
If we input col.name = input$textinput in read.csv --> we are getting this bug... My sample file has three column without headers.. i have tried with several iterations and thought to report as bug. I have raised in earlier post, since that issue has been closed i am posting as new issue..
@wch please check.. cat is also not working
library(shiny)
shinyServer(function(input, output,session) { output$contents <- renderTable({
})})
library(shiny) shinyUI(fluidPage(
titlePanel("The Ace!"), navbarPage("Calulus@Work",
tabPanel("About Tool" ), navbarMenu("Data Load", tabPanel("Delimter", sidebarLayout( sidebarPanel(fileInput('file1', 'Choose file to upload', accept = c('text/csv', 'text/comma-separated-values', 'text/tab-separated-values', 'text/plain','.csv','.tsv' )), checkboxInput('header', 'Header', TRUE), textInput("value","Enterhere","") ), mainPanel( tableOutput('contents')))))
)#fluidpage )#shinyUI
Error: "a","b","c" Error in read.table(file = file, header = header, sep = sep, quote = quote, : more columns than column names