Skip to contents

Pad circular data on both ends

Usage

pad_circ(
  data,
  circ_var,
  circ_borders = c(-90, 90),
  circ_part = 1/6,
  verbose = FALSE
)

Arguments

data

data.table to pad

circ_var

circular variable

circ_borders

range of the circular variable

circ_part

padding proportion

verbose

print extra info

Value

a padded data.table

Details

Pads the data by adding a part of the data (default: 1/6th) from one end to another end. Useful to roughly account for circularity when using non-circular methods.

Examples


dt <- data.table::data.table(x = runif(1000, -90, 90), y = rnorm(1000))
pad_circ(dt, "x", verbose = TRUE)
#> Rows in original DT: 1000, padded on the left: 175, padded on the right: 173
#>                x          y
#>            <num>      <num>
#>    1:   31.22061 -1.4047145
#>    2:  -23.17142  1.1017081
#>    3:   75.24191  0.6979863
#>    4:   32.03606 -0.8643498
#>    5:   29.72744 -1.0914704
#>   ---                      
#> 1344: -101.57177 -1.6166640
#> 1345:  -94.32620  1.8609315
#> 1346: -100.64329  0.8450042
#> 1347: -106.32629  0.3922361
#> 1348: -111.77805 -0.2931074