tidyverts / feasts

Feature Extraction And Statistics for Time Series
https://feasts.tidyverts.org/
295 stars 23 forks source link

features_all function produces untidy tibbles #77

Closed mt-edwards closed 5 years ago

mt-edwards commented 5 years ago

The feature_all function produces untidy tibbles. For example:

library(tidyverse) library(tsibbledata) library(feasts) data("aus_production")

feature_data <- aus_production %>% features_all(feat_acf)

The feature_data tibble is untidy since it includes information in the column names. You can gather and separate out this information with the following code:

featuredata %>% gather() %>% separate( col = key, into = c("name", "feature"), sep = "", extra = "merge" )

It seems that this should be the default output for the features_all function and its variations.

mitchelloharawild commented 5 years ago

features_all() is designed to behave in a similar way to *_all() scoped variants from dplyr, such as summarise_all().

If a scoped variant were written for these functions which returned the results in a long format, then I would follow suit and add this for the scoped variants of features().

For now, gathering the results into a long format as you've done above is how I recommend collecting features in a long format.