to_m function

Convert time series data to matrix with defined number of columns

Convert time series data to matrix with defined number of columns

Transforms Time Series Column of the dataframe to the matrix with specified number of columns. Number of rows will be automatically found. Eventually not complete last row will be discarded.

to_m(x, n_cols)

Arguments

  • x: * dataframe with one column
  • n_cols: * number of columns in the matrix

Returns

  • matrix with specified amount of rows

Examples

library(magrittr) library(lazytrade) macd_m <- seq(1:1000) %>% as.data.frame() %>% to_m(64)