DillonHammill / DataEditR

An Interactive R Package for Viewing, Entering Filtering and Editing Data
https://dillonhammill.github.io/DataEditR/
381 stars 40 forks source link

Dialog viewer not appropriate when calling data_edit() inside another function #22

Closed DillonHammill closed 3 years ago

DillonHammill commented 3 years ago

If you call data_edit() inside another function and set viewer = "dialog", the parental function exits early when the data editor is closed. See example:

fun <- function() {
  mtcras_new <- data_edit(mtcars)
  for(i in 1:30){
    print(i)
  }
  return(mtcars_new)
}
fun()

This issue has been reported (https://github.com/rstudio/shiny/issues/1723) but it looks like the only solution is to switch to using viewer = "browser" or viewer = "pane" in data_edit().

DillonHammill commented 3 years ago

As mentioned above, this works:

fun <- function() {
  mtcras_new <- data_edit(mtcars, viewer = "pane")
  for(i in 1:30){
    print(i)
  }
  return(mtcars_new)
}
fun()