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

fix handling of ad hoc csv file header #1057

Merged
merged 7 commits into from
Feb 22, 2024
Merged

Conversation

l-k-
Copy link
Collaborator

@l-k- l-k- commented Feb 22, 2024

Fixes #1056

For ad-hoc csv files, read.myacc.csv() returns the header arranged in rows, but g.inspectfile() was trying to access header rows as if they were columns, like this: header$sample_rate. I modified the code to correctly access the sample rate as a row of the header object.

In addition, g.inspectfile() was trying to process a header returned by read.myacc.csv() the same way it processes an Actigraph cvs header, which caused this module to crash, because a header returned by read.myacc.csv() has a different format.

Also removed the checks for rmc.bitrate and rmc.dynamic_range to be numeric -- both of these can be character strings if these values are to be read from the header.

Plus some minor cleanup.

Checklist before merging:

  • Existing tests still work (check by running the test suite, e.g. from RStudio).
  • Added tests (if you added functionality) or fixed existing test (if you fixed a bug).
  • Updated or expanded the documentation.
  • Updated release notes in inst/NEWS.Rd with a user-readable summary. Please, include references to relevant issues or PR discussions.
  • Added your name to the contributors lists in the DESCRIPTION file, if you think you made a significant contribution.

Copy link
Member

@vincentvanhees vincentvanhees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks @l-k-

@vincentvanhees vincentvanhees merged commit 4f38ec0 into master Feb 22, 2024
10 checks passed
vincentvanhees added a commit that referenced this pull request Feb 26, 2024
minor cleanup of tests that were added in #1057
@l-k- l-k- deleted the issue1056-ad-hoc-header branch February 29, 2024 15:19
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

Successfully merging this pull request may close these issues.

g.inspectfile can't extract sampling rate from header returned by read.myacc.csv()
2 participants