Pad circular data on both ends

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(x = runif(1000,-90,90), y = rnorm(1000))
pad_circ(dt, 'x', verbose = TRUE)
#> [1] "Rows in original DT: 1000, padded on the left: 168, padded on the right: 189"
#>                x          y
#>    1:   70.47125  0.3536904
#>    2:   60.06753  0.5281053
#>    3:   53.76350 -0.7394169
#>    4:   65.75197 -1.1880384
#>    5:  -10.26155  0.2826100
#>   ---                      
#> 1353: -104.81676 -0.4879511
#> 1354: -109.68114 -1.3744028
#> 1355: -113.58710 -0.6091885
#> 1356: -109.47691  0.4668818
#> 1357: -103.40466 -0.5125395