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

Zootidier fails when zoo does not have column names #1080

Closed
oliverbothe opened this issue Feb 16, 2022 · 3 comments
Closed

Zootidier fails when zoo does not have column names #1080

oliverbothe opened this issue Feb 16, 2022 · 3 comments

Comments

@oliverbothe
Copy link

I'm having trouble with applying broom::tidy on zoo-objects which do not have column names.

Reproducible example

## Example from zoo::zoo reference manual:
z2 <- zoo::zoo(matrix(1:12, 4, 3), as.Date("2003-01-01 ") + 0:3)
broom::tidy(z2)
#> Error in colnames(ret)[1:ncol(x)] <- colnames(x): Ersetzung hat Länge 0
@simonpcouch
Copy link
Collaborator

Thanks for the issue! This seems worth looking into. I'm taking some time away at the moment, but will spend some time with this and continue discussion here sooner than later.🙂

@simonpcouch
Copy link
Collaborator

Thanks again for reporting this! Just addressed in dev broom:

library(zoo)
#> 
#> Attaching package: 'zoo'
#> The following objects are masked from 'package:base':
#> 
#>     as.Date, as.Date.numeric
library(broom)

z2 <- zoo(matrix(1:12, 4, 3), as.Date("2003-01-01 ") + 0:3)
tidy(z2)
#> # A tibble: 12 × 3
#>    index      series value
#>    <date>     <chr>  <int>
#>  1 2003-01-01 x.1        1
#>  2 2003-01-01 x.2        5
#>  3 2003-01-01 x.3        9
#>  4 2003-01-02 x.1        2
#>  5 2003-01-02 x.2        6
#>  6 2003-01-02 x.3       10
#>  7 2003-01-03 x.1        3
#>  8 2003-01-03 x.2        7
#>  9 2003-01-03 x.3       11
#> 10 2003-01-04 x.1        4
#> 11 2003-01-04 x.2        8
#> 12 2003-01-04 x.3       12

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

@github-actions
Copy link

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants