tidyfun / tf

S3 classes and methods for tidy functional data
https://tidyfun.github.io/tf/
GNU Affero General Public License v3.0
5 stars 2 forks source link

unexpected warning with only one evaluation #34

Closed sebffischer closed 6 months ago

sebffischer commented 11 months ago
library(tf)
#> 
#> Attaching package: 'tf'
#> The following objects are masked from 'package:stats':
#> 
#>     sd, var
d = data.frame(time = 1, value = 2, id = "1")

x = tf::tfd(d, arg = "time", value = "value", id = "id")
#> Warning in min(diff(.x)): no non-missing arguments to min; returning Inf

Created on 2023-09-19 with reprex v2.0.2

fabian-s commented 8 months ago

not sure what to do here- makes sense to me that things start to break for "functions" with 1 evaluation? what would be the desired/optimal behavior here?

sebffischer commented 8 months ago

From a practical perspective, these things can happen in real world datasets, so handling the case would be more convenient for users. I am not familiar enough with the internals, but I guess the interpolation / extrapolation methods could just predict the constant that is observed?

jeff-goldsmith commented 8 months ago

you could also predict FPC scores from a single data point -- and "functions" with one observation sometimes come up when you have really sparse data ...