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  1.79   -0.494    0.105  0.173  
#>  2  1.70    0.118    0.118  0.0253 
#>  3  0.153   1.02    -0.280 -1.79   
#>  4 -0.0455  0.755    0.167 -0.576  
#>  5  0.197  -0.386   -0.407  0.0265 
#>  6  0.108   0.904   -0.426 -0.102  
#>  7 -0.130  -0.00990  0.124  0.0385 
#>  8  1.66    1.06    -0.387 -1.10   
#>  9 -1.41   -0.0205   0.729  0.00821
#> 10 -1.13    0.592    0.104  0.175  
#> # ℹ 90 more rows