DillonHammill / DataEditR

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

[Save & Close] button only closes but does not save any changes #3

Closed sfd99 closed 4 years ago

sfd99 commented 4 years ago

Hi Dillon,

# Make a backup DF m2,  to keep it safe... :-)
 m2  <- mtcars  

# Open m2  in Rstudio Viewer 
# and we change some values .ie: mpg from 21 to 2199 
data_edit( m2 )  

# Click on the [Save & Close] button
# and then do:
head(m2)

See? No values have been changed in m2 ...

The [Save & Close] button will close the Rstudio Viewer, but the m2 data frame has not been changed any values after the edit... The m2 values are the same as before.

(I would have expected my value edits in m2 to persist after clicking [Save...]).

pls, tell me if I misunderstood something basic.

thanks, Dillon! SFd99

DillonHammill commented 4 years ago

@sfd99, you need to re-assign the output of data_edit() to m2 in order to update the old m2:

m2 <- data_edit(m2)
head(m2)
sfd99 commented 4 years ago

ok, Dillon, understood. I took the "Save" label too literally.

Q: But then (maybe), the [Save & Close] button should just say: [Close] or even simply: [Done] ?.

I also think that a [Cancel] button would be appropriate, in case the User changes his/her mind and abandons the edit...

just a suggestion... :-)

DillonHammill commented 4 years ago

This has now been implemented on the devel branch.

devtools::install_github("DillonHammill/DataEditR", ref = "devel")

image

sch56 commented 2 years ago

Hi @DillonHammill - I really want to know whether the user exited using the Done or the Cancel button. At present there doesn't seem to be any way to do this if they haven't actually changed some data. Would it make sense to not return the data when the Cancel is pressed? Or is there another way of determining this from the calling process?

The scenario for me is:

  1. Get some data
  2. Make some proposed changes
  3. Use DataEditR for user to review or adjust
  4. Either proceed with the (adjusted) changes (Done) or back out and start again (Cancel).

At present I can't distinguish 'Done' with no change from 'Cancel' - meaning back out.

iamihgam commented 1 year ago

The results are not saved with any button. The whole purpose of editing is wasted