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

open pattern parameter of list.files for readLAScatalog or add more detailed documentation #368

Closed
Lenostatos opened this issue Aug 15, 2020 · 2 comments
Assignees
Labels
Bug

Comments

@Lenostatos
Copy link

@Lenostatos Lenostatos commented Aug 15, 2020

Dear lidR developers,

I was using the readLAScatalog function to read in a bunch of LAZ files. Because my directory contained two sets of files, one ending in "CIR.laz" and the other in "RGB.laz", I wanted to use the pattern parameter of the list.files function to only use one of the two sets, i.e. I would have preferred to write:

readLAScatalog(folder = "path/to/my/folder/", pattern = "*CIR\\.laz")

However, this results in the error "formal argument "pattern" matched by multiple actual arguments". As far as I understand it, this is because readLAScatalog already passes an argument to the pattern parameter internally. Therefore my code looks like this right now:

readLAScatalog(list.files("path/to/my/folder/", pattern = "*CIR\\.laz", full.names = TRUE))

This is of course not a big issue. I was just excited to see the hint in the documentation for the ... parameter about "Extra parameters to list.files". For me, this description seemed to mean "You don't have to use list.files explicitly here. Just pass any parameters that you would otherwise pass to list.files.".

TLDR:
I would be happy if readLAScatalog allowed its users to pass an argument to the pattern parameter of list.files, without having to call list.files explicitly. Maybe this is too much of a breaking change but in any case I think the documentation of the ... parameter to readLAScatalog should be extended a bit. Maybe something like
"Extra parameters to list.files. Typically recursive = TRUE. Please note that the pattern parameter of list.files is not supported."

What are your thoughts on this?

@Lenostatos Lenostatos changed the title open pattern parameter of list.files for readLAScatalog and add more detailed documentation open pattern parameter of list.files for readLAScatalog and add/or more detailed documentation Aug 15, 2020
@Lenostatos Lenostatos changed the title open pattern parameter of list.files for readLAScatalog and add/or more detailed documentation open pattern parameter of list.files for readLAScatalog and/or add more detailed documentation Aug 15, 2020
@Lenostatos Lenostatos changed the title open pattern parameter of list.files for readLAScatalog and/or add more detailed documentation open pattern parameter of list.files for readLAScatalog or add more detailed documentation Aug 15, 2020
Jean-Romain added a commit that referenced this issue Aug 15, 2020
@Jean-Romain Jean-Romain self-assigned this Aug 15, 2020
@Jean-Romain Jean-Romain added the Bug label Aug 15, 2020
@Jean-Romain
Copy link
Owner

@Jean-Romain Jean-Romain commented Aug 15, 2020

pattern is indeed hard coded to retain only las/laz file and providing pattern in ... is equal to pass pattern twice. If fixed it. Thank you for reporting

@Lenostatos
Copy link
Author

@Lenostatos Lenostatos commented Aug 15, 2020

Thank you for the quick fix!

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.