Trying to create a data frame like below;
X Y
20 30
Using textInput to create data frame.
But values entered in text area are not assigning properly to data frame.
Could you please help me?
ui.R
library(shiny)
shinyUI(pageWithSidebar(
headerPanel( "", ""),
sidebarPanel(
wellPanel(
textInput('datavalues', "variable values",""),
actionButton("submit","Apply")
)
),
mainPanel(
verbatimTextOutput('datatable')
)
))
server.R
library(shiny)
shinyServer(function(input,output,session){
data1= reactive({
if(input$submit!=0){
isolate({
data.frame(paste(input$datavalues))
})
}
})
output$datatable<-renderPrint(function(){
if(!is.null(data1())){
d<-data1()
print(d)
}
})
})
read.table(). You can pull it up by typing the command?read.table. That's the function you'll want to use. You may even find thatread.table("yourFileName.txt")will work right away. Then you can start looking at how to use a text string instead of a file.