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

Data Directory Automatic .file Files Loading error #251

Closed
2 of 5 tasks
UTexas80 opened this issue May 2, 2018 · 17 comments
Closed
2 of 5 tasks

Data Directory Automatic .file Files Loading error #251

UTexas80 opened this issue May 2, 2018 · 17 comments

Comments

@UTexas80
Copy link
Contributor

UTexas80 commented May 2, 2018

Report an Issue / Request a Feature

I'm submitting a (Check one with "x") :

  • bug report
  • feature request

Issue Severity Classification -

(Check one with "x") :

Expected Behavior
Steps to Reproduce Behavior

I have attached the tbl.cancel.file for additional documentation. The context of the file is:

path: O:/IT/Scholarships Project/Files/tbl_Cancels
extension: csv

Version Information
@rsangole rsangole added the Under investigation Default label before an issue is classified as Bug/Feature/... label May 2, 2018
@rsangole
Copy link
Collaborator

rsangole commented May 2, 2018

@UTexas80 I don't see a tbl.cancel.file attached. Could you check again please?

@UTexas80
Copy link
Contributor Author

UTexas80 commented May 2, 2018

@UTexas80 UTexas80 closed this as completed May 2, 2018
@UTexas80 UTexas80 reopened this May 2, 2018
@UTexas80
Copy link
Contributor Author

UTexas80 commented May 2, 2018 via email

@KentonWhite
Copy link
Owner

This is from the Google Groups submission and might provide a bit more context:

Hello,

I was wondering if you can please provide some guidance regarding the .file Files loading feature. I am attempting to load data that is not stored in the current project using a .file file.

I specified the path and the extension that the file would have as if it were being loaded by the standard ProjectTemplate auto-loader. The error I received is as follows:

Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  : 
  line 1 did not have 3 elements
In addition: Warning message:
In read.table(filename, header = config$data_loading_header) :
  incomplete final line found by readTableHeader on 'data/tbl_Cancels.file.txt'

I have attached the tbl.cancel.file for additional documentation. The context of the file is:

path: O:/IT/Scholarships Project/Files/tbl_Cancels
extension: csv
tbl_Cancels.file.txt

@KentonWhite
Copy link
Owner

@UTexas80 My first thought is that the file is called tbl_Cancels.file.txt and so might be read by the txt file reader. Can you change the name to tbl_Cancels.file and see if the error message changes?

@UTexas80
Copy link
Contributor Author

UTexas80 commented May 2, 2018

Hey Kenton - I have tried that approach but windows still references the file as .txt. In other words, after I remove the .file extension the properties of the file are still a text source file. I am unsure as to how to designate it as a .file File as specified in the Project Template documentation. Do you have a working example of one of these files?
Thank you.

@rsangole
Copy link
Collaborator

rsangole commented May 2, 2018

@UTexas80 on a windows machine I think it's possible to remove/rename the extension but windows tries to be "clever" and keeps it in the back end. It's quite annoying. Have you ensured the file extention is truly being changed? There's an option through explorer I believe, or try doing it through the command line.

@UTexas80
Copy link
Contributor Author

UTexas80 commented May 2, 2018

Yes Rahul, I have absolutely removed the .file extension. Do you have an example of creating it through the command line? I did a google search but came up empty.

@Hugovdberg
Copy link
Collaborator

You should not remove the .file part but the .txt part instead. If the the file now is called tbl_Cancels.txt it will indeed be parsed by the txt.reader and not the file.reader. You can use the list.data() command in R to see al your data files and cached variables and an indication which reader is selected for the file.

@Hugovdberg
Copy link
Collaborator

If you could paste the output of list.data() in the issue we can more effectively help you troubleshoot your problem.

@UTexas80
Copy link
Contributor Author

UTexas80 commented May 2, 2018

image
input input.xls input FALSE FALSE
meta meta.xls meta FALSE FALSE
tbl.BannerCohorts tbl_BannerCohorts.txt tbl.BannerCohorts FALSE FALSE
tbl.Cancels tbl_Cancels.csv tbl.Cancels FALSE FALSE
tbl.scholarshipAwd tbl_scholarshipAwd.csv tbl.scholarshipAwd FALSE FALSE
tbl.scholarshipCohorts tbl_scholarshipCohorts.csv tbl.scholarshipCohorts FALSE FALSE
tblGaCommitmentFundList.OSFA tblGaCommitmentFundList_OSFA.csv tblGaCommitmentFundList.OSFA FALSE FALSE
is_cached cache_only reader
input FALSE FALSE xls.reader
meta FALSE FALSE xls.reader
tbl.BannerCohorts TRUE FALSE wsv.reader
tbl.Cancels TRUE FALSE csv.reader
tbl.scholarshipAwd TRUE FALSE csv.reader
tbl.scholarshipCohorts TRUE FALSE csv.reader
tblGaCommitmentFundList.OSFA TRUE FALSE csv.reader

@Hugovdberg
Copy link
Collaborator

You can see that the file is called tbl_BannerCohorts.txt, and it will be imported using the wsv.reader (for whitespace separated values). You can actually rename the file from within R by calling file.rename. I guess you should call

file.rename('data/tbl_BannerCohorts.txt', 'data/tbl_BannerCohorts.file')

to fix the issue.

@UTexas80
Copy link
Contributor Author

UTexas80 commented May 2, 2018

Here is the result after calling the file.rename function:

Loading data set: tbl.BannerCohorts
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'O:/IT/Scholarships Project/Files/tbl_BannerCohorts': No such file or directory
Here is my directory contents:

image

and here is my list.data output

list.data
function (override.config = NULL)
{
config <- .load.config(override.config)
.list.data(config)
}
<environment: namespace:ProjectTemplate>

@rsangole
Copy link
Collaborator

rsangole commented May 2, 2018

@UTexas80 you need to call list.data() to run the function. list.data will only print the function itself.

@UTexas80
Copy link
Contributor Author

UTexas80 commented May 2, 2018

My apologies...

image

list.data()
filename varname is_ignored is_directory
tbl.BannerCohorts tbl_BannerCohorts.file tbl.BannerCohorts FALSE FALSE
input input.xls input FALSE FALSE
meta meta.xls meta FALSE FALSE
tbl.Cancels tbl_Cancels.csv tbl.Cancels FALSE FALSE
tbl.scholarshipAwd tbl_scholarshipAwd.csv tbl.scholarshipAwd FALSE FALSE
tbl.scholarshipCohorts tbl_scholarshipCohorts.csv tbl.scholarshipCohorts FALSE FALSE
tblGaCommitmentFundList.OSFA tblGaCommitmentFundList_OSFA.csv tblGaCommitmentFundList.OSFA FALSE FALSE
is_cached cache_only reader
tbl.BannerCohorts TRUE FALSE file.reader
input FALSE FALSE xls.reader
meta FALSE FALSE xls.reader
tbl.Cancels TRUE FALSE csv.reader
tbl.scholarshipAwd TRUE FALSE csv.reader
tbl.scholarshipCohorts TRUE FALSE csv.reader
tblGaCommitmentFundList.OSFA TRUE FALSE csv.reader

@Hugovdberg
Copy link
Collaborator

Ah I guess I see what's going wrong now, so you have the tbl_BannerCohorts.file which points at a file in another location. That file is read correctly but now the path setting inside that file points to a file without the extension:

path: O:/IT/Scholarships Project/Files/tbl_BannerCohorts
extension: csv

If you add the file extension to the path variable (which could differ from the extension in the extension setting) then the file.reader should be able to read the file you try to import.

@UTexas80
Copy link
Contributor Author

UTexas80 commented May 2, 2018

YES!!!!!

That's so awesome. That did the trick. Thank you very much!

@rsangole rsangole removed the Under investigation Default label before an issue is classified as Bug/Feature/... label May 2, 2018
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

4 participants