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

consider implementing iso_file_lists as vctr classes #78

Open
sebkopf opened this issue Oct 11, 2019 · 2 comments
Open

consider implementing iso_file_lists as vctr classes #78

sebkopf opened this issue Oct 11, 2019 · 2 comments

Comments

@sebkopf
Copy link
Contributor

sebkopf commented Oct 11, 2019

the new vctrs package provides efficient implementations of complex type vectors and would solve several issues with S3 method dispatch for different types of iso files objects (e.g. continuous flow vs. dual inlet).

the caveat is that individual iso_file objects are not as easily clearly defined to stay compatible with different file format imports.

gotta think this through carefully whether it makes sense

@japhir
Copy link
Contributor

japhir commented Oct 29, 2020

I think this would be great. If I understand correctly it would get rid of these lines, right?

if (length(iso_files) == 0) return(tibble())

I think it would be best if you have a length-0 iso_files list, it should return the tibble with all the desired columns of the correct type. I'm not sure if this is right, but for one of my functions I'm now considering:

  # part of the `get_inits()` function, function should always return below data structure?
  if (nrow(.did) == 0L) {
    return(
      tibble(file_id = character(), Analysis = character(),
             s44_init = double(), r44_init = double())
    )
  }

but it seems like vctrs might do this kind of housekeeping in a better way?

@japhir
Copy link
Contributor

japhir commented Oct 29, 2020

or is this what you use

safe_bind_rows <- function(df_list, exclude = names(make_iso_file_data_structure()$file_info)) {
for?

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

No branches or pull requests

2 participants