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

Error creating a simple fable #198

Closed
robjhyndman opened this issue May 13, 2020 · 1 comment
Closed

Error creating a simple fable #198

robjhyndman opened this issue May 13, 2020 · 1 comment

Comments

@robjhyndman
Copy link
Member

library(dplyr)
library(tsibble)
library(fabletools)

# This works
tsibble(
    y = c(1, 2, 3),
    date = as.Date(c("2000-01-01", "2000-01-02", "2000-01-03")),
    index = date
  ) %>%
  mutate(dist = dist_unknown(3)) %>%
  as_fable(response = y, distribution = dist)
#> # A fable: 3 x 3 [1D]
#>       y date       dist  
#>   <dbl> <date>     <dist>
#> 1     1 2000-01-01 ?     
#> 2     2 2000-01-02 ?     
#> 3     3 2000-01-03 ?

# But this doesn't
fable(
  y = c(1, 2, 3),
  date = as.Date(c("2000-01-01", "2000-01-02", "2000-01-03")),
  index = date,
  dist = dist_unknown(3),
  response = y,
  distribution = dist
)
#> Error: Can't convert a `quosure/formula` object to a string

Created on 2020-05-13 by the reprex package (v0.3.0)

@mitchelloharawild
Copy link
Member

Works fine with dev fabletools. We're avoiding bare expressions, especially for the response attribute as it is no longer required as a column in the dataset.

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(tsibble)
library(fabletools)

# This works
tsibble(
  y = c(1, 2, 3),
  date = as.Date(c("2000-01-01", "2000-01-02", "2000-01-03")),
  index = date
) %>%
  mutate(dist = dist_unknown(3)) %>%
  as_fable(response = "y", distribution = "dist")
#> # A fable: 3 x 3 [1D]
#>       y date       dist  
#>   <dbl> <date>     <dist>
#> 1     1 2000-01-01 ?     
#> 2     2 2000-01-02 ?     
#> 3     3 2000-01-03 ?

# But this doesn't
fable(
  y = c(1, 2, 3),
  date = as.Date(c("2000-01-01", "2000-01-02", "2000-01-03")),
  index = date,
  dist = dist_unknown(3),
  response = "y",
  distribution = "dist"
)
#> # A fable: 3 x 3 [1D]
#>       y date       dist  
#>   <dbl> <date>     <dist>
#> 1     1 2000-01-01 ?     
#> 2     2 2000-01-02 ?     
#> 3     3 2000-01-03 ?

Created on 2020-05-13 by the reprex package (v0.3.0)

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