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: 174
#>                 x          y
#>             <num>      <num>
#>    1:   17.725499  0.6665378
#>    2:  -16.766347 -1.4215347
#>    3:   64.499067  1.1700562
#>    4:    3.182613 -1.4047145
#>    5:   86.272814  1.1017081
#>   ---                       
#> 1345: -104.575617  1.2997510
#> 1346: -101.571769 -1.6159855
#> 1347:  -94.326205 -0.3147511
#> 1348: -100.643293 -0.4056825
#> 1349: -106.326294  1.1533874