Add rows directly in a r shiny apps

I'm working on a Shiny app with 2 tables, 1 graph and a conditional answer .

I want to add a row to a table directly in Shiny and update results.

For example, in a table with an id, 2 dates and 2 multiples choices questions. I have 3 observations and I want a user to be able to add n others observations, which should cause the other table and graph to update with this new observations.

Is it possible? If yes how do you do this?

Thank you, forgive my poor english.

Here a link of my Shiny apps

and here the code who work :

i have already try this for my question :

    h3("Ajout d'un nouveau patient"), 

#Date inclusion
dateInput("date_inclu", "Date de l'inclusion", value = ,language = "fr"),

#Date reponse
dateInput("date_rep", "Date de reponse", value = ,language = "fr"),

textInput("dose", "Dose administree", ),

textInput("tox", "Reponse toxicite", ),


    identifiant =length(data_time$identifiant)
    dose =reactive(input$dose)
    date_inclusion =reactive(input$date_inclu)
    date_reponse =reactive(input$date_rep)
    reponse =reactive(input$tox)

    nouveau_pat = cbind(identifiant,  dose,  date_inclusion,    date_reponse,   reponse)
    nouveau_pat =

    data_time = rbind(data_time,nouveau_pat)

but that doesn't work


One way to do this is to rely on the matrixInput function of the shinyIncubator package. The shinyIncubator package has development features that are sometimes eventually merged with shiny. Given its amazingness, I expect that matrixInput or something like it will be part of base shiny within our lifetimes.

I made a demo:


For me the hardest part was getting matrixInput to show its colnames, which are hidden by default. What you need to do here is customize the display style. You can do this in a css or, as I did, in the body of your ui.R using tags. The key is to assign display: table-header-group to .tableinput .hide. Other display features can be found by using the inspect element option of your browser : Firefox and Chrome both have that feature; other browsers probably do too.

  tags$style(type = "text/css"
    , ".tableinput .hide {display: table-header-group;}"

Finally i found a way to do this,


#Stockage des donnes
  makeData <- observe({

  #affichage table pat
  output$table_pat <- renderTable({
    table_pat = data.frame(Identifiant = input$Identifiant,
                           Date_inclusion =as.character(input$datei),
                           Dose = input$dose,
                           Date_reponse =as.character(input$dater),
                           Reponse = input$reponse)


  headerPanel("OPTIMUM TRIAL"),


    h3("Ajout d'un nouveau patient"),
    textInput("Identifiant","Identifiant du patient:",value =""),

    selectInput("dose", "Dose:",
                c(1,2,3,4,5,6), selected = 1),
    selectInput("reponse", "Reponse:",
                c("Succes","Echec"), selected = "Succes"),

    #Date inclusion
    dateInput("datei", "Date de l'inclusion:", format = "yyyy-mm-dd",value =Sys.Date(),language = "fr"),

    #Date reponse
    dateInput("dater", "Date de reponse:", format = "yyyy-mm-dd",value =Sys.Date(),language = "fr"),

    submitButton("Ajouter le patient"),

    h3("Supprimer un patient"),

    textInput("Supprimer","Identifiant du patient a supprimer:", value = ""),

    submitButton("Supprimez le patient")



    h3("Nouveau patient"),

    h3("Historique des patients"),

Input data are write in a file text and with a read.table in the beginning of your code you can update your table. However you need to restart your app. There is probably a better way that allows to update without restarting the app but I have not found it

You can use the following function to avoid the first reading of data defaults (find in a other question in stackoverflow (Delayed execution in R Shiny app)

#Fonction pour ne pas imprimer lors du lancement de la page
  values <- reactiveValues(starting = TRUE)
  session$onFlushed(function() {
    values$starting <- FALSE

  #Stockage des donnees
  makeData <- observe({
    if (values$starting){

    else {


Need Your Help

Get domain of server where swf is being called

javascript jquery actionscript-3 flash

I have SWF hosted on a domain lets say I am embedding that swf in an html page which is on Now, within the SWF, how can I get the domain where SWF is being embedded i.e. i...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.