DillonHammill / DataEditR

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

[Bug] - When "Inserting column left/right" other column data is removed #12

Closed NeuronalMike closed 3 years ago

NeuronalMike commented 3 years ago

1) Column data to the right is removed when I add more than one Column. It seems to only happen after I've already added one Column to the left or right. Pictured below with mtcars dataset

mtcars_new <- DataEditR::data_edit(mtcars,
                        save_as = "mtcars.csv",
                        write_fun = "write.table",
                        write_args = list(sep = ",",
                                          row.names = TRUE))

2020-12-10 23-46-53 2020-12-10 23-38-39

2) If I rename a column after entering in data, that variables' data is removed and I have to re-enter the data all over again.

2020-12-10 23-31-51

Fantastic work on the package too and such great progress. Very excited by it. Keep up the great work.

DillonHammill commented 3 years ago

Thanks for reporting this @Inferno118899, I just pushed a fix to patch this. It is actually a rhandsontable bug that is difficult to track down and fix. So instead I have just patched the code in dataEdit to ensure that all the original data is retained when columns are added. This won't fix your second issue - I am looking into this now...

DillonHammill commented 3 years ago

Good news! I managed to track down the problem in rhandsontable! Turns out new columns get assigned a column class of logical as they are initiated with NA values and when the data is entered it is coerced to class logical as well. This forces characters/numerics to be converted into NAs and so it essentially deletes these entries from the table. I have pushed the relevant fix to my fork of rhandsontable to ensure that columns starting with class logical are converted to a more appropriate class when data is entered. This means that no changes were required to DataEditR but you will need to update your rhandsontable as below:

devtools::install_github("DillonHammill/rhandsontable")

Please let me know how you go, and feel free to reopen this issue if it remains unresolved.

NeuronalMike commented 3 years ago

Well Done @DillonHammill !! Great work 👍