Huh / collar

Utilities for exploring telemetry data
Other
6 stars 9 forks source link

Inconsistency in the use of directories and files being passed to functions #41

Closed Huh closed 5 years ago

Huh commented 5 years ago

For the sake of user experience it would be nice if all of the functions took a directory or a file, but not both and not some combination of one or the other.

Thoughts on which is better? I tend to think a vector of file names is better than a directory.

foresthayes commented 5 years ago

To clarify - do you mean that we should make a single choice for the package whether to use directories or file names?

If so, my primary hesitation about using a vector of file names would be complicating user input for multiple key files or .csv files. On the other hand, for functions that save an output to disk I would be reticent not to allow the user to specify a file name.

Huh commented 5 years ago

I am of the opinion that fetch_vectronics should take a vector paths to key files. This is more flexible and easier for the user. Imagine you wanted to explore the data from a single collar. As it stands you would have to move that key to a new directory and then tell the function the directory that holds the single key...this seems backwards. We can provide a little function that wraps up the list.files call.

@foresthayes you ok with this? I would like to merge this sometime tomorrow and I think you are using the package.

Huh commented 5 years ago

fetch_csv uses file_paths as is, but fetch_vectronics uses a directory.

I refactored on my branch to use file paths. The user will now have to...

key_dir <- system.file("extdata", package = "collar")
get_paths(key_dir) %>%
  fetch_vectronics()

I think this is a small price given the added flexibility of being able to look at a single collar, which seems to happen a lot due to collars missing, mortalities and the like.

Does this screw you up @foresthayes ?

foresthayes commented 5 years ago

As it stands you would have to move that key to a new directory and then tell the function the directory that holds the single key...this seems backwards.

This make sense - and embarrassingly I have done just that (moving a single key to a separate folder) for testing purposes. Given this switch I would advocate moving all functions only using file paths.

Does this screw you up @foresthayes ?

No issues on my end.

Huh commented 5 years ago

Perfect, consider it done. Thanks for the quick replies at an odd hour.