Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: "cannot open the connection" when dataframe name contains a "." #20

Closed
drcanak opened this issue May 18, 2021 · 4 comments
Closed

Comments

@drcanak
Copy link

drcanak commented May 18, 2021

The first line of the the following code works as expected.

data_edit(mpg)
mpg.1 <- mpg
data_edit(mpg.1)

However, when the dataframe name contains a "." the following error gets triggered:

Listening on http://127.0.0.1:6197
Warning in file(file, "rt") :
cannot open file 'mpg.1': No such file or directory
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

Admittedly, I didn't check other special characters or such in the dataframe name, but I discovered in my own syntax, where I will sometimes use MyData, MyData.1, etc.... Not familiar enough with R, or reading library syntax to even begin to troubleshoot what might be going on here. Sorry.

Really like the package by the way.

@DillonHammill
Copy link
Owner

DillonHammill commented May 18, 2021

It is not good practice to use . when naming objects in R, instead you should use _. The main reason for this is that . is used primarily when supplying the name of file and so mpg.1 looks like a file called mpg with an extension 1. As documented on the website, data_edit() can also read in files directly so when it sees mpg.1 it tries to read in a file with extension 1 for which the default reading function read.csv() will not work. Since data_edit() can support any reading/writing functions it is impossible to determine whether you are referring to an R object or a file.

@drcanak
Copy link
Author

drcanak commented May 19, 2021

Good to know. Thank you for the quick and thoughtful reply.

@DillonHammill
Copy link
Owner

Happy to help! Have fun using DataEditR!

@DillonHammill
Copy link
Owner

@drcanak, in case anyone else encounters the same issue, I have just added a patch for this in DataEditR v0.1.3 which is available for download from GitHub:

devtools::install_github("DillonHammill/DataEditR")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants