Skip to contents

n-2 points are drawn from a normal distribution with mean=0, sd=1, the points in the final two direction are sampled along a spiral by samping the angle from a normal distribution with mean=0, sd=2*pi (absolute values are used to fix the orientation of the spiral).

Usage

spiral_data(n, p)

Arguments

n

number of sample points to generate

p

sample dimensionality

Value

sample points in matrix format

Examples

spiral_data(100, 4)
#> # A tibble: 100 × 4
#>         V1      V2      V3     V4
#>      <dbl>   <dbl>   <dbl>  <dbl>
#>  1  0.868   0.161   0.0437  0.879
#>  2  0.0444  0.625  -0.111  -0.540
#>  3 -1.24    1.31   -0.958   0.320
#>  4 -0.383  -0.363   1.26   -0.417
#>  5  1.67   -0.494   0.689  -0.154
#>  6  0.215  -0.571  -0.393  -0.264
#>  7 -0.828  -0.381  -1.12    1.13 
#>  8 -0.743  -1.03   -0.0272  0.888
#>  9 -0.285  -3.43   -0.364   0.118
#> 10 -1.37    0.0250 -0.688  -0.902
#> # ℹ 90 more rows