# Reshaping Multiple Time Series

Source: `R/ts_long_wide.R`
`ts_long.Rd`

Functions to reshape multiple time series from 'wide' to 'long' and vice versa. Note that long format data frames are ts-boxable objects, where wide format data frames are not. `ts_long` automatically identifies a time column, and uses columns on the left as id columns.

    ts_long(x)

    ts_wide(x)

## Arguments

x | a ts-boxable time series, or a wide `data.frame`, `data.table`, or `tibble`.

## Value

object with the same class as input

## Examples

    df.wide <- ts_wide(ts_df(ts_c(mdeaths, fdeaths)))
    head(df.wide)
    #>         time mdeaths fdeaths
    #> 1 1974-01-01    2134     901
    #> 2 1974-02-01    1863     689
    #> 3 1974-03-01    1877     827
    #> 4 1974-04-01    1877     677
    #> 5 1974-05-01    1492     522
    #> 6 1974-06-01    1249     406head(ts_long(df.wide))
    #>        id       time value
    #> 1 mdeaths 1974-01-01  2134
    #> 2 mdeaths 1974-02-01  1863
    #> 3 mdeaths 1974-03-01  1877
    #> 4 mdeaths 1974-04-01  1877
    #> 5 mdeaths 1974-05-01  1492
    #> 6 mdeaths 1974-06-01  1249