Skip to contents

Create a matrix or data frame of defined dimensions, whose columns are random normal vectors

Usage

rnormmat(
  nrow = 10,
  ncol = 10,
  mean = 0,
  sd = 1,
  return_df = FALSE,
  seed = NULL
)

Arguments

nrow

Integer: Number of rows.

ncol

Integer: Number of columns.

mean

Float: Mean.

sd

Float: Standard deviation.

return_df

Logical: If TRUE, return data.frame, otherwise matrix.

seed

Integer: Set seed for rnorm.

Value

matrix or data.frame.

Author

EDG

Examples

x <- rnormmat(20, 5, mean = 12, sd = 6, return_df = TRUE, seed = 2026)
x
#>           V1        V2        V3        V4         V5
#> 1  15.123534 10.027968  5.056477 11.151176  5.0665352
#> 2   5.521855 11.011911 16.667993 13.003979 21.0534981
#> 3  12.835429  3.647827  4.774669 10.807268  5.0670230
#> 4  11.491507 20.794949 13.840285 10.252757  2.6591291
#> 5   8.000162 12.289241  6.998049  1.593618 11.6685124
#> 6  -3.096534 23.448503 20.508847 10.363630 17.0951590
#> 7   7.589119 22.385667 16.270717  1.200423 11.9334197
#> 8   5.879266 12.348875  9.585014 18.916446  7.4381170
#> 9  12.681327 15.871969 16.796173  5.980083 19.0547955
#> 10  9.157254 22.353774 14.558907 12.889260 26.4866983
#> 11  9.550712  8.826198  4.980608 15.116980  0.2489234
#> 12  7.617400 12.998352 10.762799 12.032618 20.8415394
#> 13 10.671380 10.471659  6.416338 20.082125  9.1506962
#> 14 10.645101 13.996694 14.696385  6.917799 17.8870259
#> 15 -3.281289 13.094597  8.131161 14.660388  1.0538687
#> 16 20.082009 18.987562 10.611464  6.137103 10.4363351
#> 17 15.698449 15.560957  4.581792 24.746947  6.2469281
#> 18 13.305386  6.649322  6.234268 16.126194  9.0582257
#> 19  7.171687 15.463520 12.803738  9.939791  5.5362197
#> 20 16.138481  7.050567  6.005684 16.711017 14.2165555