DillonHammill / DataEditR

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

data_edit() from within a function? #27

Closed alanryder closed 3 years ago

alanryder commented 3 years ago

df <- data_edit(df) works on the console (really nicely!). I would like to be able to call df <- data_edit(df) from within a function, but when I do that I get:

Warning in file(file, "rt") : cannot open file 'df': No such file or directory Warning: Error in file: cannot open the connection 62: file 61: read.table 60: read.csv 58: module 53: callModule 52: moduleServer 51: dataInputServer 50: server Error in file(file, "rt") : cannot open the connection

This seems like a Shiny thing, but I don't know Shiny. Is there a way to use data_edit under program control?

DillonHammill commented 3 years ago

Sounds like a scoping issue. If you define your data within your function before calling data_edit() it should work. I will take a closer look later today.

alanryder commented 3 years ago

You seem to be right.

test_edit <- function(df) { df2 <- df df2 <- data_edit(df2) return(df2) }

seems to behave as I want.

Thanks for your help.