Skip to contents

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

Usage

runifmat(
  nrow = 10,
  ncol = 10,
  min = 0,
  max = 1,
  return_df = FALSE,
  seed = NULL
)

Arguments

nrow

Integer: Number of rows.

ncol

Integer: Number of columns.

min

Float: Min.

max

Float: Max.

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 <- runifmat(20, 5, min = 12, max = 18, return_df = TRUE, seed = 2026)
x
#>          V1       V2       V3       V4       V5
#> 1  16.19204 14.04935 14.22721 13.79049 12.74151
#> 2  15.33918 14.06063 17.24867 17.37344 17.70928
#> 3  12.84084 13.39538 14.60758 15.39645 16.69029
#> 4  13.71434 12.36821 14.64082 14.73305 17.77282
#> 5  15.33221 14.47426 12.49174 14.39681 12.68551
#> 6  12.15079 13.11307 12.20772 12.49803 17.86531
#> 7  14.79738 14.46403 17.57191 15.78210 15.72282
#> 8  17.16606 12.84049 13.76740 14.79057 17.56456
#> 9  13.51501 12.03261 15.11535 15.43427 13.21342
#> 10 15.48484 15.61043 13.41838 15.97339 13.29318
#> 11 12.03560 17.46606 17.83086 17.26745 17.53155
#> 12 16.15120 13.05218 15.79507 14.27362 16.33269
#> 13 13.38675 16.38712 17.74961 16.34145 16.57021
#> 14 17.09119 12.09694 17.31812 17.14715 13.71166
#> 15 12.92301 15.51669 15.13910 13.11753 14.06195
#> 16 14.14086 14.55491 16.29549 15.79619 14.04836
#> 17 15.27123 13.26295 16.44386 16.30869 16.72776
#> 18 12.00719 14.86320 12.27538 15.25084 14.18700
#> 19 13.90695 16.52894 17.74676 13.22828 15.99074
#> 20 12.10374 14.68098 13.20682 17.39993 14.23687