Swechhya / excelR

An Interface to 'jExcel.js' Library
https://swechhya.github.io/excelR/
Other
152 stars 19 forks source link

strange behaviour on overwiting cells content #102

Open pi-at-git opened 2 years ago

pi-at-git commented 2 years ago

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):

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

Swechhya commented 2 years ago

@pi-at-git Can you download the latest development version and check if you are still facing this issue?

pi-at-git commented 2 years ago

@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
Swechhya commented 1 year ago

@pi-at-git Can you let me know what type of behavior you expect in this case? Should it always change , to .?