Skip to content
This repository has been archived by the owner on May 19, 2021. It is now read-only.

Package to help working with filepaths #99

Open
1danjordan opened this issue Aug 9, 2017 · 2 comments
Open

Package to help working with filepaths #99

1danjordan opened this issue Aug 9, 2017 · 2 comments

Comments

@1danjordan
Copy link

1danjordan commented Aug 9, 2017

Working with filepaths in R is a total pain in the ass, mainly because we treat them exclusively as character vectors. This means we're stuck parsing filepaths with messy regexes at best, and still no way of reliably building filepaths apart from string concatenation. There's also no way of building relative and absolute paths reliably.

I propose a package with a Path object that provides us structured filepaths and methods in a similar way to Ammonite's Path object in Scala. For some concrete examples of this, you can see Li Haoyi demonstrating it at minute 18 of his A Better Scala REPL talk.

This package could have implementations of list.files, list.dirs, getwd and so on, or Path could provide a factory method for parsing their outputs so we could still use them like list.files() %>% Path.

I believe the current state of filepaths is a real pain point, and think a solution like this would be a good direction, but am obviously open to discussing other solutions!

@gaborcsardi
Copy link
Contributor

Good idea. Here is some (incomplete) preliminary work: https://github.com/richfitz/pathr

@1danjordan
Copy link
Author

1danjordan commented Aug 9, 2017

Another advantage would be handling paths regardless of OS - escaping Windows paths or flipping them is driving me nuts on my work machine! 😒

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

No branches or pull requests

2 participants