I have a poorly formatted time series dataset in which a single column contains all time series consecutively, and another column contains the trial number.
Example:
| Trial | Fx |
|---|---|
| 1 | 7.9 |
| 1 | 8.0 |
| 1 | 8.1 |
| 1 | 8.2 |
| 2 | 6.5 |
| 2 | 6.6 |
| 2 | 6.7 |
| 2 | 6.8 |
The ultimate goal is to apply signal::filtfilt() to each time series; however, each time series must be filtered separately for this to work appropriately.
I attempted group_by() prior to filtfilt() which resulted in an error. Therefore, I'd like to spread the time series (Fx) into multiple columns by trial so I can filter each column separately, something like this:
| Fx_1 | Fx_2 |
|---|---|
| 7.9 | 6.5 |
| 8.0 | 6.6 |
| 8.1 | 6.7 |
| 8.2 | 6.8 |