Closed Danny-dK closed 2 years ago
I think the error is coming from specifying read_fun
when you are not readying the data from file (i.e. you are in fact using an empty template). If you remove the read_fun
part it should work fine. I will take a closer look to see if I put in a more permanent fix to prevent this from happening.
@Danny-dK, I can't seem to replicate this issue on my machine but I have just pushed a fix that will hopefully fix the problem for you. Please pull down the latest version of DataEditR from GitHub and try again:
devtools::install_github("DillonHammill/DataEditR")
Thanks @DillonHammill for looking into it. The read function is needed to tell the library what function to use when reading in the data in the graphical user interface (by clicking on the browse button):
My csv is ; delimited, hence it requires csv2, the default of read.csv that DataEditR uses does not read the data in properly.
I found that it is not specifically a read_fun thing, but pertains mainly on drag selecting both lines and then running:
(Note that in the above there is no read_fun)
But it does work fine by just clicking on the first line and then run.
I'll try the latest version and get back to you.
Nope, the new version has the same
I tried to screenrecord a short video which was in webm but I tried converting to mp4 (hopefully it plays okay).
The associated error in the console is:
Warning in file(file, "rt") :
cannot open file 'test <- data_edit(x = NULL,
code = 'D:/create_table.R')
': Invalid argument
Warning: Error in file: cannot open the connection
61: file
60: read.table
59: read.csv
57: module
52: callModule
51: moduleServer
50: dataInputServer
49: server
Error in file(file, "rt") : cannot open the connection
Thanks @Danny-dK, this is helpful - looks like the app is crashing as it is trying to read in NULL
data for some reason. I will take a closer look. In the meantime, this should work just fine:
mydata <- data_edit(
x = c(10,10),
code = "D:/data_recreate2.R",
read_fun = "read.csv2"
)
@DillonHammill yep that solves it! Tis a minor thing for me to add the table dimensions now that I know how to solve it.
@Danny-dK, I just pushed another fix to GitHub. Please can you pull it down again and let me know if the original issue is resolved?
devtools::install_github("DillonHammill/DataEditR")
@DillonHammill At least it doesn't crash now, but......
Just clicking the first line and running does run without problem (still specific to selecting lines and running).
Ah I think I am onto the problem now, I will try and fix this today.
OK, so the issue was actually coming from the RStudio addin side of things. Any highlighted text is treated as a dataset that should be passed to the data_edit()
addin, obviously we don't want this behaviour when the entire data_edit()
call is highlighted. I just pushed a fix to make sure the highlighted text is in fact an R object before trying to read it in as data. Please pull down the latest version of DataEditR from GitHub (version 0.1.5) and let me know how you go.
devtools::document("DillonHammill/DataEditR")
@DillonHammill Awesome, it's solved. You can close this issue.
Thank you for looking into it. Also thank you for all the work on this library, it is much appreciated! (it will do wonders for my colleagues that are not experienced with R and are more used to graphical user interfaces) Keep up the good work! :)
No worries! Thanks for reporting this issue.
This works: Drag select entire line and run.
But this doesn't (i.e. breaking the line): Drag select all lines and run.
It returns with error:
it does run if I place the cursor on the first line (so not selecting anything) and then run.
Is that to be expected?
System: windows 10 R 4.1.2 Rstudio 2021.9.1.372 DataEditR 0.1.4