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

set domain to union when concatenating? #1

Open
jeff-goldsmith opened this issue May 9, 2022 · 1 comment
Open

set domain to union when concatenating? #1

jeff-goldsmith opened this issue May 9, 2022 · 1 comment
Labels
question Further information is requested

Comments

@jeff-goldsmith
Copy link
Contributor

building on #2, although the behavior might show up elsewhere.

after downsampling, the original and downsampled data have different domains; if you wanted to concatenate these in a single vector, you'd get an error:

library(tidyfun)
#> Registered S3 method overwritten by 'GGally':
#>   method from   
#>   +.gg   ggplot2
#> 
#> Attaching package: 'tidyfun'
#> The following objects are masked from 'package:stats':
#> 
#>     sd, var
library(tidyverse)
#> Warning: package 'tidyr' was built under R version 4.0.5
#> Warning: package 'dplyr' was built under R version 4.0.5

data(chf_df)

chf_hour_df = 
  chf_df %>% 
  filter(day == "Mon") %>% 
  select(id, activity) %>% 
  mutate(
    act_hour = tf_smooth(activity, method = "rollmean", k = 60, align = "right"),
    act_hour = tfd(act_hour, arg = seq(60, 1440, by = 60)))  %>% 
  select(-activity) 
#> setting fill = 'extend' for start/end values.

c(chf_df$activity[1], chf_hour_df$act_hour[1])
#> Error in vec_ptype2_tfd_tfd(x, y, ...): all(compatible[, "domain"]) is not TRUE

Created on 2022-05-09 by the reprex package (v0.3.0)

this is the intended behavior, and the use case is maybe not that compelling -- it's not exactly this example, but being able to show full and downsampled data on the same plot would be helpful.

a few questions:

  • is an error here better than a warning?
  • what's the preferred workaround? changing the arg in tfd ...?
  • should we allow direct editing of the domain through tf_domain() <-?
@jeff-goldsmith jeff-goldsmith added the question Further information is requested label May 9, 2022
@fabian-s fabian-s transferred this issue from tidyfun/tidyfun May 10, 2022
@fabian-s
Copy link
Contributor

option 3, ad more informative error message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants