-
Notifications
You must be signed in to change notification settings - Fork 159
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
conflicting file extensions #138
Comments
A shapefile reader is pretty great! One thought would be to override the .dbf extension using We created the ability to add new readers as separate packages to address the design challenges of Basically every time a new data type is added, we would need to check if it interferes with an currently supported data type. If it does, we would need to decide precedence for loading. This becomes an N-Squared problem. With the current release we made a design decision that new data types can be supported as separate packages. The current data types are the core and additional ones can be added by the user. Not only can people now create their own readers without worrying that other users' tool chains will be broken, they are free to override the behavior of existing types, as I've suggested with the .dbf extension. Please let me know if you have trouble overriding the .dbf extension or if it doesn't work as it should. When your shapefile package is ready please let me know and I'll add it to the website. |
Yes! that's an excellent solution. On the other hand, I had to perform a couple of non-recommended operations that give rise to NOTEs in a R CMD check:
Calling other package's functions throug Thanks! |
Glad it works! I agree that the hacks are not very elegant. Here are some thoughts -- may or may not work. Rather than calling Right now there is no way to avoid referencing While working on the alternative, we have reached a compromise with CRAN where we have replaced If you don't want |
Thank you for your suggestions. In any case, I hope it helps someone else using ProjectTemplate and shapefiles. |
How about creating your own As for the |
You mean a I agree with your second thought. But it requires a structural change in how ProjectTemplate loads datasets. I don't dare to make such modification myself. |
If you decide to give it a try anyway, I'll be happy to review the pull request. I think this is closely related to #140. |
Indeed. Haven't you implemented such a more flexible approach in your package |
As I said -- I'm not happy with LoadMyData, I think the whole idea is flawed. Perhaps LoadMyData could be really useful if it produced source code instead of actually executing code. Then, ProjectTemplate could add this source code to an R file and execute this file. The benefit here is that it gives the user full control over the data loading process, while at the same time providing a sensible default that works in many cases. This could be achieved with a few minor modifications. For detecting file types, we could use yihui/mime, which in turn could be expanded to detect file types based on content (and not on the extension) using |
@famuvie I've played around with the shapefile reader and like how it works! I hadn't considered that |
Yes, I think the |
Hi @KentonWhite, any progress on this issue? shall we open a new one? |
@famuvie What about introducing a convention that directory names can have extensions too, and a generic reader passes all the files in the directory to a specific reader for data loading. So, there could be a directory called Some thought would have to be given to the recursive load config parameter, but I'm sure there's a solution there. This would be a generic solution to other types of multi file object also. For example, I'm interested in text analysis and these are usually initialised by loading many training files in a directory into a single |
Seems good to me, @connectedblue. Yet, the implementation should allow single files in |
@famuvie agreed. I have my hands full at the moment with a data project that needs completing by the end of the year, so I don't want to get distracted. However, we could work on it in the new year if you're up for it? |
I thought I had exposed this behaviour. My main computer is in the shop this week and will check once I have it back. If the behaviour isn't exposed I'll add it in. |
Great! thanks folks. |
I wrote a draft shapefile reader to be used with ProjectTemplate (related with this question in the mailing list).
However I find an extension conflict issue with shapefiles:
ProjectTemplate
as an XBASE formatpackage:foreign
, before the.shp
file (due to alphabetical ordering).shp
extension, the base name of the file is found in memory and thus skippedThis is a design problem in
.load.data()
. It is assumed implicitly that each recognized file corresponds to one object. While in the case of shapefiles this is not the case.The text was updated successfully, but these errors were encountered: