Data Directory Automatic .file Files Loading error
Closed this issue · 17 comments
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") :
- 1 - Severe
- 2 - Moderate
- 3 - Low
tbl_BannerCohorts.file.txt
tbl_BannerCohorts.file.txt
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
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
@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?
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.
@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.
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.
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.
If you could paste the output of list.data()
in the issue we can more effectively help you troubleshoot your problem.
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
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.
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:
and here is my list.data output
list.data
function (override.config = NULL)
{
config <- .load.config(override.config)
.list.data(config)
}
<environment: namespace:ProjectTemplate>
@UTexas80 you need to call list.data()
to run the function. list.data
will only print the function itself.
My apologies...
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
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.
YES!!!!!
That's so awesome. That did the trick. Thank you very much!