Commit aa78619b authored by jlopez's avatar jlopez
Browse files

Big update

parent c9561c67
"","mpg","cyl","disp","hp","drat","wt","qsec","vs","am","gear","carb"
"Mazda RX4",21,6,160,110,3.9,2.62,16.46,0,1,4,4
"Mazda RX4 Wag",21,6,160,110,3.9,2.875,17.02,0,1,4,4
"Datsun 710",22.8,4,108,93,3.85,2.32,18.61,1,1,4,1
"Hornet 4 Drive",21.4,6,258,110,3.08,3.215,19.44,1,0,3,1
"Hornet Sportabout",18.7,8,360,175,3.15,3.44,17.02,0,0,3,2
"Valiant",18.1,6,225,105,2.76,3.46,20.22,1,0,3,1
"Duster 360",14.3,8,360,245,3.21,3.57,15.84,0,0,3,4
"Merc 240D",24.4,4,146.7,62,3.69,3.19,20,1,0,4,2
"Merc 230",22.8,4,140.8,95,3.92,3.15,22.9,1,0,4,2
"Merc 280",19.2,6,167.6,123,3.92,3.44,18.3,1,0,4,4
"Merc 280C",17.8,6,167.6,123,3.92,3.44,18.9,1,0,4,4
"Merc 450SE",16.4,8,275.8,180,3.07,4.07,17.4,0,0,3,3
"Merc 450SL",17.3,8,275.8,180,3.07,3.73,17.6,0,0,3,3
"Merc 450SLC",15.2,8,275.8,180,3.07,3.78,18,0,0,3,3
"Cadillac Fleetwood",10.4,8,472,205,2.93,5.25,17.98,0,0,3,4
"Lincoln Continental",10.4,8,460,215,3,5.424,17.82,0,0,3,4
"Chrysler Imperial",14.7,8,440,230,3.23,5.345,17.42,0,0,3,4
"Fiat 128",32.4,4,78.7,66,4.08,2.2,19.47,1,1,4,1
"Honda Civic",30.4,4,75.7,52,4.93,1.615,18.52,1,1,4,2
"Toyota Corolla",33.9,4,71.1,65,4.22,1.835,19.9,1,1,4,1
"Toyota Corona",21.5,4,120.1,97,3.7,2.465,20.01,1,0,3,1
"Dodge Challenger",15.5,8,318,150,2.76,3.52,16.87,0,0,3,2
"AMC Javelin",15.2,8,304,150,3.15,3.435,17.3,0,0,3,2
"Camaro Z28",13.3,8,350,245,3.73,3.84,15.41,0,0,3,4
"Pontiac Firebird",19.2,8,400,175,3.08,3.845,17.05,0,0,3,2
"Fiat X1-9",27.3,4,79,66,4.08,1.935,18.9,1,1,4,1
"Porsche 914-2",26,4,120.3,91,4.43,2.14,16.7,0,1,5,2
"Lotus Europa",30.4,4,95.1,113,3.77,1.513,16.9,1,1,5,2
"Ford Pantera L",15.8,8,351,264,4.22,3.17,14.5,0,1,5,4
"Ferrari Dino",19.7,6,145,175,3.62,2.77,15.5,0,1,5,6
"Maserati Bora",15,8,301,335,3.54,3.57,14.6,0,1,5,8
"Volvo 142E",21.4,4,121,109,4.11,2.78,18.6,1,1,4,2
#!/usr/bin/python
import time
print "Start : %s" % time.ctime()
time.sleep( 1 )
print "End : %s" % time.ctime()
MenuGauche = sidebarMenu(id="sidebarmenu", MenuGauche = sidebarMenu(id="sidebarmenu",
menuItem("", tabName="inputs", icon=icon("pencil", lib="font-awesome"), newtab=FALSE), menuItem("Input Pipeline 1", tabName="inputs", icon=icon("pencil", lib="font-awesome"), newtab=FALSE),
menuItem("", tabName="input2", icon=icon("file", lib="font-awesome"), newtab=FALSE), menuItem("Input Pipeline 2", tabName="input2", icon=icon("file", lib="font-awesome"), newtab=FALSE),
tags$br(), tags$br(),
......
...@@ -9,6 +9,8 @@ library(yaml) ...@@ -9,6 +9,8 @@ library(yaml)
library(stringr) library(stringr)
library(shinyFiles) library(shinyFiles)
library(tools) library(tools)
library(knitr)
library(DT)
source("./pages/pages_def_inputs.R", local=T) source("./pages/pages_def_inputs.R", local=T)
......
tabinput2 = fluidPage( tabinput2 = fluidPage(
box(title = "Parameters :", width = 4, status = "primary", collapsible = TRUE, solidHeader = TRUE,
tabsetPanel(type = "tabs",
tabPanel("Biblio", height = "300px", style = "overflow: hidden; overflow-y:scroll",
textInput("first_name", label = "First name :", value = "", width = "400px"),
textInput("last_name", label = "Last name :", value = "", width = "400px")
)
)
),
box(title = "Results :", width = 8, status = "primary", collapsible = TRUE, solidHeader = TRUE, style = "overflow: hidden; overflow-x:scroll",
actionButton("runApp", "Run", icon("play"), class="btn btn-primary"),
br(), br(), DT::dataTableOutput("report_input2")
)
) )
tabinputs = fluidPage( tabinputs = fluidPage(
box(title = "Parameters :", width = 4, status = "primary", collapsible = TRUE, solidHeader = TRUE,
tabsetPanel(type = "tabs",
tabPanel("Param panel 1", height = "300px", style = "overflow: hidden; overflow-y:scroll",
textInput("param1", label = "Input Param1 :", value = "", width = "400px"), textInput("param1", label = "Input Param1 :", value = "", width = "400px"),
sliderInput("param2", label = "Slider param2 :", min = 0, max = 100, step = 1, width = "400px", value = 50), sliderInput("param2", label = "Slider param2 :", min = 0, max = 100, step = 1, width = "400px", value = 50),
...@@ -10,20 +15,45 @@ tabinputs = fluidPage( ...@@ -10,20 +15,45 @@ tabinputs = fluidPage(
selectInput("param5", label = "Selected param5 :", choices = list("1" = 1, "2" = 2, "3" = 3), selected = "3", width = "400px"), selectInput("param5", label = "Selected param5 :", choices = list("1" = 1, "2" = 2, "3" = 3), selected = "3", width = "400px"),
radioButtons("param6", label = "Radio param6 :", choices = list("rad1" = "rad1", "rad2" = "rad2", "rad3" = "rad3"), selected = "rad1", width = "400px"),
fileInput("param7", label = "Chose file :", accept = c(".csv", ".xslx"), multiple = FALSE, width = "400px"),
checkboxInput("param8", label = "Checkbox 1", value = TRUE), checkboxInput("param8", label = "Checkbox 1", value = TRUE),
checkboxInput("param9", label = "Checkbox 2", value = FALSE), checkboxInput("param9", label = "Checkbox 2", value = FALSE),
actionButton("testButton", "Test", class="btn btn-success"), actionButton("testButton", "Test", class="btn btn-success"),
actionButton("runP", "Run", icon("save"), class="btn btn-primary"), actionButton("testButton2", "", icon("play"), class="btn btn-danger"),
p("Just simple text for description or help") p("Just simple text for description or help")
),
tabPanel("Param panel 2", height = "300px", style = "overflow: hidden; overflow-y:scroll",
textInput("param10", label = "Input Param 10 :", value = "", width = "400px"),
radioButtons("param6", label = "Radio param6 :", choices = list("rad1" = "rad1", "rad2" = "rad2", "rad3" = "rad3"), selected = "rad1", width = "400px"),
fileInput("param7", label = "Chose file :", accept = c(".csv", ".xslx"), multiple = FALSE, width = "400px")
),
tabPanel("Param panel 3", height = "300px", style = "overflow: hidden; overflow-y:scroll"),
tabPanel("Param panel 4", height = "300px", style = "overflow: hidden; overflow-y:scroll"),
tabPanel("Param panel 5", height = "300px", style = "overflow: hidden; overflow-y:scroll")
)
),
box(title = "Results :", width = 8, status = "primary", collapsible = TRUE, solidHeader = TRUE, style = "overflow: hidden; overflow-x:scroll",
actionButton("runP", "Run pipeline", icon("save"), class="btn btn-primary"),
br(), br(), uiOutput("report_inputs")
)
) )
first_name: ""
last_name: ""
param1: "tutu"
param2: 50
param3_min: 11.8
param3_max: 19.6
param3_step: 0.1
param4: "B"
param5: 3
param8: true
param9: false
param10: ""
param7: ""
salut
```r
print(3+5)
```
```
## [1] 8
```
RV_input2 <- reactiveValues(data = data.frame())
output$report_input2 <- DT::renderDataTable({
return(RV_input2$data)
}, filter="top", escape = FALSE,selection = list(mode="single",target = "cell"), rownames= FALSE,server = TRUE)
#' Event when use runApp button
observeEvent(input$runApp, {
# Params
path_param <- "/home/jimmy/jimmy/projets/sag/app/pipeline/params/params_input2.yml"
res <- ""
# Panel : informations_user
if(!is.na(as.numeric(input$first_name))) {
res <- paste(res, "first_name:", input$first_name, "\n", sep = " ")
} else {
res <- paste(res, "first_name:", paste0('"', input$first_name, '"'), "\n", sep = " ")
}
if(!is.na(as.numeric(input$last_name))) {
res <- paste(res, "last_name:", input$last_name, "\n", sep = " ")
} else {
res <- paste(res, "last_name:", paste0('"', input$last_name, '"'), "\n", sep = " ")
}
write(res, file=path_param)
system(paste(" pwd", "", "input$first_name" , "", "input$last_name" , sep = " " ))
RV_input2$data <- read.csv("/home/jimmy/jimmy/projets/sag/app/cars.csv", header = TRUE)
})
#' Event when use testButton button #' Event when use testButton button
observeEvent(input$testButton, { observeEvent(input$testButton, {
})
#' Event when use testButton2 button
observeEvent(input$testButton2, {
}) })
#' Event when use runP button #' Event when use runP button
observeEvent(input$runP, { observeEvent(input$runP, {
print(paste0(" python /home/jimmy/mon_script.py -i2 ", input$param6, " -t ", input$param1, " ", input$param4, " -path1 ", input$param7$datapath )) # Params
path_param <- "/home/jimmy/jimmy/projets/sag/app/pipeline/params/params_inputs.yml"
res <- ""
# Panel : panel1
if(!is.na(as.numeric(input$param1))) {
res <- paste(res, "param1:", input$param1, "\n", sep = " ")
} else {
res <- paste(res, "param1:", paste0('"', input$param1, '"'), "\n", sep = " ")
}
res <- paste(res, "param2:", input$param2, "\n", sep = " ")
res <- paste(res, "param3_min:", input$param3[1], "\n", sep = " ")
res <- paste(res, "param3_max:", input$param3[2], "\n", sep = " ")
res <- paste(res, "param3_step:", "0.1", "\n", sep = " ")
if(!is.na(as.numeric(input$param4))) {
res <- paste(res, "param4:", input$param4, "\n", sep = " ")
} else {
res <- paste(res, "param4:", paste0('"', input$param4, '"'), "\n", sep = " ")
}
if(!is.na(as.numeric(input$param5))) {
res <- paste(res, "param5:", input$param5, "\n", sep = " ")
} else {
res <- paste(res, "param5:", paste0('"', input$param5, '"'), "\n", sep = " ")
}
if(input$param8) {
res <- paste(res, "param8:", "true", "\n", sep = " ")
} else {
res <- paste(res, "param8:", "false", "\n", sep = " ")
}
if(input$param9) {
res <- paste(res, "param9:", "true", "\n", sep = " ")
} else {
res <- paste(res, "param9:", "false", "\n", sep = " ")
}
# Panel : panel2
if(!is.na(as.numeric(input$param10))) {
res <- paste(res, "param10:", input$param10, "\n", sep = " ")
} else {
res <- paste(res, "param10:", paste0('"', input$param10, '"'), "\n", sep = " ")
}
res <- paste(res, "param7:", paste0('"', input$param7$datapath, '"'), "\n", sep = " ")
# Panel : panel3
# Panel : panel4
# Panel : panel5
write(res, file=path_param)
system(paste(" python", "", "/home/jimmy/jimmy/projets/sag/app/mon_script.py" , "-i3", "input$param6" , "-t", "input$param1" , "", "input$param4" , "-path1", "input$param7$datapath" , "-params_file", "/home/jimmy/jimmy/projets/sag/app/pipeline/params/params_inputs.yml", sep = " " ))
if(file.exists("/home/jimmy/jimmy/projets/sag/app/result.Rmd")) {
output$report_inputs <- renderUI({
includeMarkdown(knit("/home/jimmy/jimmy/projets/sag/app/result.Rmd", quiet = TRUE))
})
}
}) })
......
App: App:
project: "/home/jimmy/jimmy/projets/sag/app/pipeline" project: "/home/jimmy/jimmy/projets/sag/app/pipeline" # important : if dir exist we delete all tree directory
general: general:
title: "Pipeline in R" title: "Pipeline in R"
skin: "green" # other color : https://rstudio.github.io/shinydashboard/appearance.html skin: "green" # other color : https://rstudio.github.io/shinydashboard/appearance.html
menu_width: 230 menu_width: 230
pages: [ # important : no space in 'name' field pages: [ # important : no space in 'name' field and unique 'name' in all file
{ #Page 1
icon: "pencil", # icon possible : https://fontawesome.com/icons?from=io { #Page 1
label: "Input Pipeline", # the label in left menu icon: "pencil", # icon possible : https://fontawesome.com/icons?from=io
name: "inputs", # the name of the page label: "Input Pipeline 1", # the label in left menu
content: [ # type possible : text, slider, select, radio, checkbox, file, button, help name: "inputs", # the name of the page
{name: "param1", type: "text", value: "", label: "Input Param1 :"}, content: [ # list the panel
{name: "param2", type: "slider", min: 0, max: 100, step: 1, value: [50], label: "Slider param2 :"}, {
{name: "param3", type: "slider", min: 10, max: 20, step: 0.1, value: [11.8, 19.6], label: "Slider param3 :"} , # slider max 2 numeric value panel: "Param panel 1",
{name: "param4", type: "select", selected: "B", choices: ["A", "B", "C"], label: "Selected param4 :"}, name: "panel1",
{name: "param5", type: "select", selected: 3, choices: [1, 2, 3], label: "Selected param5 :"}, content: [# type possible : text, slider, select, radio, checkbox, file, button, help
{name: "param6", type: "radio", selected: "rad1", choices: ["rad1", "rad2", "rad3"], label: "Radio param6 :"}, {name: "param1", type: "text", value: "", label: "Input Param1 :"},
{name: "param7", type: "file", multiple: FALSE, accept: [".csv", ".xslx"], label: "Chose file :"}, {name: "param2", type: "slider", min: 0, max: 100, step: 1, value: [50], label: "Slider param2 :"},
{name: "param8", type: "checkbox", value: TRUE, label: "Checkbox 1"}, {name: "param3", type: "slider", min: 10, max: 20, step: 0.1, value: [11.8, 19.6], label: "Slider param3 :"} , # slider max 2 numeric value
{name: "param9", type: "checkbox", value: FALSE, label: "Checkbox 2"}, {name: "param4", type: "select", selected: "B", choices: ["A", "B", "C"], label: "Selected param4 :"},
{name: "testButton", type: "button", icon: "", class: "btn btn-success", label: "Test"}, # class : primary, success, danger, warning, info {name: "param5", type: "select", selected: 3, choices: [1, 2, 3], label: "Selected param5 :"},
{name: "runP", type: "button", icon: "save", class: "btn btn-primary", label: "Run"}, # icon possible : https://fontawesome.com/icons?from=io {name: "param8", type: "checkbox", value: TRUE, label: "Checkbox 1"},
{name: "help1", type: "help", label: "Just simple text for description or help"} {name: "param9", type: "checkbox", value: FALSE, label: "Checkbox 2"},
], {name: "testButton", type: "button", icon: "", class: "btn btn-success", label: "Test"}, # class : primary, success, danger, warning, info
pipeline: { {name: "testButton2", type: "button", icon: "play", class: "btn btn-danger", label: ""},
shiny_button: "runP",
program: "python", {name: "help1", type: "help", label: "Just simple text for description or help"}
options: [ ]
{name: "/home/jimmy/mon_script.py", shiny_name: ""}, } ,
{name: "-i2", shiny_name: "param6"}, {
{name: "-t", shiny_name: "param1"}, panel: "Param panel 2",
{name: "", shiny_name: "param4"}, name: "panel2",
{name: "-path1", shiny_name: "param7"} content: [
{name: "param10", type: "text", value: "", label: "Input Param 10 :"},
{name: "param6", type: "radio", selected: "rad1", choices: ["rad1", "rad2", "rad3"], label: "Radio param6 :"},
{name: "param7", type: "file", multiple: FALSE, accept: [".csv", ".xslx"], label: "Chose file :"}
]
},
{
panel: "Param panel 3",
name: "panel3",
content: [
]
},
{
panel: "Param panel 4",
name: "panel4",
content: [
]
},
{
panel: "Param panel 5",
name: "panel5",
content: [
] ]
} }
}, ],
{ #Page 2 pipeline: {
name: "input2", shiny_button: {name: "runP", type: "button", icon: "save", class: "btn btn-primary", label: "Run pipeline"}, # icon possible : https://fontawesome.com/icons?from=io
icon: "file", program: "python",
label: "Input Pipeline 2", options: [
content: [], {name: "", type: "value", value: "/home/jimmy/jimmy/projets/sag/app/mon_script.py"},
pipeline: [] {name: "-i3", type: "shiny", value: "param6"},
{name: "-t", type: "shiny", value: "param1"},
{name: "", type: "shiny", value: "param4"},
{name: "-path1", type: "shiny-file", value: "param7"}, # diffent because with file input the traitement is different
{name: "-params_file", type: "panel"} # for add the path of yml contain all params
],
output_format: "markdown",
output: "/home/jimmy/jimmy/projets/sag/app/result.Rmd"
} }
},
{ #Page 2
name: "input2",
icon: "file",
label: "Input Pipeline 2",
content: [
{
panel: "Biblio",
name: "informations_user",
content: [
{name: "first_name", type: "text", value: "", label: "First name :"},
{name: "last_name", type: "text", value: "", label: "Last name :"}
]
}
],
pipeline: {
shiny_button: {name: "runApp", type: "button", icon: "play", class: "btn btn-primary", label: "Run"},
program: "pwd",
options: [
{name: "", type: "shiny", value: "first_name"},
{name: "", type: "shiny", value: "last_name"},
],
output_format: "table",
output: "/home/jimmy/jimmy/projets/sag/app/cars.csv"
}
}
] ]
salut
```{r, echo=TRUE}
print(3+5)
```
This diff is collapsed.
salut
```r
print(3+4)
```
```
## [1] 7
```
...@@ -142,7 +142,7 @@ App: ...@@ -142,7 +142,7 @@ App:
- -
name: "-i1" name: "-i1"
shiny_name: "radioButtons1" shiny_name: "radioButtons2"
- -
name: "-path2" name: "-path2"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment