Skip to content

head() and tail() drop the class #96

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

Closed
dajmcdon opened this issue Jun 5, 2022 · 0 comments · Fixed by #105
Closed

head() and tail() drop the class #96

dajmcdon opened this issue Jun 5, 2022 · 0 comments · Fixed by #105
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@dajmcdon
Copy link
Contributor

dajmcdon commented Jun 5, 2022

library(epiprocess)
#> 
#> Attaching package: 'epiprocess'
#> The following object is masked from 'package:stats':
#> 
#>     filter

head(jhu_csse_daily_subset)
#> # A tibble: 6 × 6
#>   geo_value time_value case_rate_7d_av death_rate_7d_av cases cases_7d_av
#>   <chr>     <date>               <dbl>            <dbl> <dbl>       <dbl>
#> 1 ca        2020-03-01         0.00327         0            6        1.29
#> 2 ca        2020-03-02         0.00435         0            4        1.71
#> 3 ca        2020-03-03         0.00617         0            6        2.43
#> 4 ca        2020-03-04         0.00980         0.000363    11        3.86
#> 5 ca        2020-03-05         0.0134          0.000363    10        5.29
#> 6 ca        2020-03-06         0.0200          0.000363    18        7.86
tail(jhu_csse_daily_subset)
#> # A tibble: 6 × 6
#>   geo_value time_value case_rate_7d_av death_rate_7d_av cases cases_7d_av
#>   <chr>     <date>               <dbl>            <dbl> <dbl>       <dbl>
#> 1 tx        2021-12-26            41.5            0.119 12559      12177.
#> 2 tx        2021-12-27            44.7            0.188 17331      13137 
#> 3 tx        2021-12-28            46.9            0.197 14795      13770.
#> 4 tx        2021-12-29            48.9            0.195 14286      14365.
#> 5 tx        2021-12-30            50.4            0.205 15600      14811.
#> 6 tx        2021-12-31            51.4            0.205 15762      15096.

Created on 2022-06-05 by the reprex package (v2.0.1)

These methods both convert to tibble then dispatch to the data.frame methods. They should either use epiprocess:::reclass() afterword, or, likely better, use [.epi_df.

Possibly see here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants