title: Rewrite reactive dataset in R Shiny
body: <p>I have problem with reactive dataset. I use eventReactive() to change column data type in reactive dataset <strong>df1</strong>. It works fine. New dataset with changed column data type is <strong>modified_df1</strong>. But now, when i want to change datatype in another column, previous change will be reset. It is because i still use <strong>df1</strong> as main dataframe beafore change. Is there some way how to rewrite <strong>df1</strong> beafore second datatype change?</p>
  <pre><code> df1 &lt;- reactive({
        req(input$file1)
        df &lt;- read.csv(input$file1$datapath,
                       header = input$header,
                      sep = input$sep,
                      quote = input$quote)
       df
     })
     
     
     colnames &lt;- reactive({ 
       names(df1()) })
     
     observeEvent(df1(), {
       updateCheckboxGroupInput(session, &quot;class_var&quot;,
                                label = &quot;Select Columns&quot;,
                                choices = colnames(),
                                selected = &quot;&quot;) 
     })
  
   modified_df1 &lt;- eventReactive(input$chg_class, {
       if (input$choose_class == &quot;Numeric&quot;) {
         var &lt;- df1() %&gt;% mutate(across(all_of(input$class_var), ~ as.numeric(.)))
       } else if (input$choose_class == &quot;Factor&quot;) {
         var &lt;- df1() %&gt;% mutate(across(all_of(input$class_var), ~ as.factor(.)))
       } else if (input$choose_class == &quot;Character&quot;) {
         var &lt;- df1() %&gt;% mutate(across(all_of(input$class_var), ~ as.character(.)))
       } else if (input$choose_class == &quot;Date&quot;) {
         var &lt;- df1() %&gt;% mutate(across(all_of(input$class_var), ~ as.Date(.)))
       }else if (input$choose_class == &quot;Integer&quot;) {
         var &lt;- df1() %&gt;% mutate(across(all_of(input$class_var), ~ as.integer(.)))
       }
     })
  </code></pre>