I am newbie to R
, so please bear with me. I have done a lot of googling and went through documentation also for this question, finally decided to post this question here.
My objective: It is to call a shell script(awk
) when someone clicks on Submit button.
Tried so far: I tried pipe("ls -l /tmp | awk '!/^total/ {print $5}'", input$run)
in server.R
file but it is giving me error saying.
Error in pipe: invalid 'open' argument
If experts could help me here will be grateful to you, I want to simply execute a shell script once people click on Submit button on my UI.
Adding my server.R
and ui.R
as follows too now.
ui.R
library(shiny)
ui = fluidPage(
selectInput("state12", "Choose a environment:",
list(`Environment` = c("DEV", "chumma"))
),
selectInput("state", "Choose a repository:",
list(`repository` = c("test","test1"))
),
textAreaInput("caption", "Caption", "", width = "1000px"),
textOutput("result"),
textOutput("result1"),
verbatimTextOutput("value"),
actionButton(
inputId = "submit_loc",
label = "Submit"
),
actionButton("run", "Change Function and Run"),
verbatimTextOutput("msg")
)
server.R
library(shiny)
server = function(input, output) {
output$result <- renderText({
paste("You selected environment", input$state12)
})
output$result1 <- renderText({
paste("You selected environment", input$state)
})
output$value <- renderText({ input$caption })
output$msg <- renderText({
pipe("ls -l /tmp | awk '!/^total/ {print $5}'", input$run)
})
}
Thanks,
R. Singh