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

Expose attributes on realtime data #160

Closed
DaveHutch opened this issue Sep 2, 2021 · 1 comment
Closed

Expose attributes on realtime data #160

DaveHutch opened this issue Sep 2, 2021 · 1 comment

Comments

@DaveHutch
Copy link

Describe the bug
The returned tibble from tidyhydat::realtime_dd() contains attributes: 'Queried on:' and 'Date range:' but are not accessible through attr() command.

To Reproduce
rt_data <- tidyhydat::realtime_dd(station_number = "07EA004")

head(rt_data)

Expected behavior

head(rt_data)
Queried on: 2021-09-02 23:27:35 (UTC)
Date range: 2021-08-03 to 2021-08-03

A tibble: 6 x 8

STATION_NUMBER PROV_TERR_STATE_LOC Date Parameter Value Grade Symbol Code

1 07EA004 BC 2021-08-03 08:00:00 Flow 47.5 NA NA 1
2 07EA004 BC 2021-08-03 08:05:00 Flow 47.4 NA NA 1
3 07EA004 BC 2021-08-03 08:10:00 Flow 47.5 NA NA 1

@boshek
Copy link
Collaborator

boshek commented Sep 7, 2021

Thanks for this. I think with the range data it is probably best accessed through normal R tools like:

R> rt_data <- tidyhydat::realtime_dd(station_number = "07EA004")
                                                           
R> range(rt_data$Date)
[1] "2021-08-08 08:00:00 UTC" "2021-09-07 19:30:00 UTC"

I will however add the query time as an attributes to be accessed like:

attributes(rt_data)$query_time

@boshek boshek closed this as completed in 09234f9 Sep 7, 2021
boshek added a commit that referenced this issue Sep 7, 2021
expose and store properly query time. Closes #160
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