strange behaviour on overwiting cells content
Hello! Thanks for this really amazing package. I hope you find the time to keep up with this the great work. Unfortunately, I noticed some strange behavior when I overwrite cell content. My objective is to to a plausibility check on manually entered values. In the attached minimal example, the decimal separator is changed in case someone entered a "," instead of a "." in column Sepal.Width (I used the excelR version form the official CRAN repo):
- on start, the value of Sepal.Width, row 2 is "3"
- if you overwrite "3" in Sepal.Width, row 2 with "3,3" it's automatically transformed into "3.3"
- if you overwrite "3.3" in Sepal.Width, row 2 again with "3,3" it stays "3,3" (the "," is not changed to "." in the frontend, despite it's changed in the underlying table as you can see from the console)
- if you now overwrite "3.2" in Sepal.Width, row 3 with "5,5", it not only corrects Sepal.Width, row 3 to "5.5" but also changes "3,3" to "3.3" in Sepal.Width, row 2
- if you now overwrite "5.5" in Sepal.Width, row 3 again with "5,5", the "5.5" remains in the frontend
- if you again overwrite "3.3" in Sepal.Width, row 2, "3,3" remains in row 2 and "5,5" remains in row 3
Here is my code:
library(shiny)
library(excelR)
library(data.table)
ui <- fluidPage(excelOutput("table1"))
server <- function(input, output, session) {
customReactVals <- reactiveValues(table1 = data.table(head(iris)))
output$table1 <- renderExcel({
excelTable(data = customReactVals$table1)
})
observeEvent(input$table1,{
DT_table_data <- copy(data.table(excel_to_R(input$table1)))
DT_table_data[, Sepal.Width := gsub(",",".", Sepal.Width, fixed=TRUE)]
print(DT_table_data)
customReactVals$table1 <- copy(DT_table_data)
})
}
shinyApp(ui, server)
and here the output of my sessionInfo() [Ubuntu 20.04, but observed the same behavior on Windows and with RStudio RConnect server] other attached packages: [1] data.table_1.14.0 excelR_0.4.0 shiny_1.6.0
@pi-at-git Can you download the latest development version and check if you are still facing this issue?
@Swechhya unfortunately, I see no difference. I'd like to doublecheck that I installed the latest dev version correctly. Can you please have a look at the following code:
install.packages("devtools")
install_github("Swechhya/excelR") # installed in a local directory below /home/test_user/
library(excelR, lib.loc="/home/test_user/R/x86_64-pc-linux-gnu-library/4.1") # avoid loading the "standard" version
sessionInfo()
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] excelR_0.4.0
@pi-at-git Can you let me know what type of behavior you expect in this case? Should it always change , to .?