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.830   0.0327 -0.0248 -0.566 
#>  2 -1.48   -0.0174  0.124   0.0377
#>  3 -1.59    1.86   -0.530   0.782 
#>  4  0.619  -1.78    0.470  -0.452 
#>  5  0.900   0.962   0.455   0.691 
#>  6  0.672  -0.476  -0.208   0.251 
#>  7  0.0585  0.0299  0.464   0.683 
#>  8  1.33    0.0961  0.628   0.487 
#>  9  0.807   1.97    0.126   0.127 
#> 10 -0.335  -1.35   -0.277  -0.434 
#> # ℹ 90 more rows