Skip to contents

Replicate profiles data.frame

Usage

replicate_profiles(
  profiles,
  replications,
  probabilities = NULL,
  replacement = TRUE,
  seed_used = NULL
)

Arguments

profiles

data.frame of profiles

replications

integer, final number of observations

probabilities

vector of probabilities with the same length as the number of rows of profiles. Does not need to add up to 1 (are reweighted)

replacement

Boolean whether replacement is used

seed_used

Integer with the seed to be used for consistent results

Value

Resampled data.frame of profiles

Examples

replicate_profiles(profiles=data.frame(id=1:100,age=rnorm(100,60,5)),
replications=200,probabilities=rep(1,100))
#>      id      age
#> 1    53 64.86068
#> 2    96 62.27801
#> 3    86 61.77975
#> 4     8 63.36101
#> 5    78 59.96021
#> 6     9 55.86871
#> 7    15 59.97309
#> 8    82 52.78938
#> 9    57 56.50847
#> 10   75 52.14863
#> 11   36 48.52603
#> 12  100 51.41564
#> 13   42 57.02326
#> 14   38 57.34284
#> 15   67 50.33553
#> 16   16 53.20849
#> 17   70 56.81184
#> 18   87 58.20143
#> 19   85 60.81049
#> 20   90 50.19041
#> 21   25 64.14152
#> 22   59 72.31685
#> 23   91 64.72991
#> 24   36 48.52603
#> 25   78 59.96021
#> 26   75 52.14863
#> 27   87 58.20143
#> 28   99 60.63920
#> 29   13 65.05859
#> 30   99 60.63920
#> 31   66 61.97664
#> 32    7 51.15308
#> 33   49 55.66449
#> 34   31 61.91994
#> 35   63 56.73663
#> 36   14 58.42614
#> 37   64 59.26415
#> 38   73 63.03659
#> 39   63 56.73663
#> 40    5 58.49860
#> 41   68 65.27251
#> 42   67 50.33553
#> 43   47 58.48647
#> 44   53 64.86068
#> 45   69 55.89510
#> 46   90 50.19041
#> 47   75 52.14863
#> 48   41 63.37635
#> 49   45 56.95071
#> 50   16 53.20849
#> 51   47 58.48647
#> 52   59 72.31685
#> 53    9 55.86871
#> 54   76 61.56420
#> 55   56 58.65257
#> 56   65 53.62949
#> 57   15 59.97309
#> 58   95 65.19766
#> 59   67 50.33553
#> 60   54 61.29451
#> 61   24 69.29332
#> 62  100 51.41564
#> 63   12 58.25723
#> 64    8 63.36101
#> 65   79 68.63516
#> 66   67 50.33553
#> 67   27 63.00026
#> 68   93 57.11267
#> 69   16 53.20849
#> 70   66 61.97664
#> 71   22 60.02838
#> 72   76 61.56420
#> 73   86 61.77975
#> 74   87 58.20143
#> 75   82 52.78938
#> 76    4 63.02939
#> 77   81 58.20827
#> 78   90 50.19041
#> 79   62 66.24378
#> 80   45 56.95071
#> 81   94 53.85858
#> 82   63 56.73663
#> 83   45 56.95071
#> 84   91 64.72991
#> 85   78 59.96021
#> 86   14 58.42614
#> 87   55 66.03735
#> 88   14 58.42614
#> 89   53 64.86068
#> 90   56 58.65257
#> 91   26 65.99518
#> 92   82 52.78938
#> 93   96 62.27801
#> 94   42 57.02326
#> 95   53 64.86068
#> 96  100 51.41564
#> 97   37 56.84227
#> 98   47 58.48647
#> 99   24 69.29332
#> 100  10 58.54052
#> 101  38 57.34284
#> 102  14 58.42614
#> 103  75 52.14863
#> 104  97 48.10037
#> 105  68 65.27251
#> 106  48 67.08641
#> 107  55 66.03735
#> 108  35 57.92750
#> 109  64 59.26415
#> 110  47 58.48647
#> 111  90 50.19041
#> 112  80 70.43234
#> 113  15 59.97309
#> 114  30 59.36833
#> 115  72 52.91797
#> 116  46 65.21969
#> 117  69 55.89510
#> 118  72 52.91797
#> 119   8 63.36101
#> 120  97 48.10037
#> 121  26 65.99518
#> 122  94 53.85858
#> 123  52 61.88323
#> 124  95 65.19766
#> 125  45 56.95071
#> 126  37 56.84227
#> 127  49 55.66449
#> 128  98 62.98783
#> 129  31 61.91994
#> 130  31 61.91994
#> 131  87 58.20143
#> 132  21 67.92249
#> 133  82 52.78938
#> 134  38 57.34284
#> 135  27 63.00026
#> 136  87 58.20143
#> 137  15 59.97309
#> 138  81 58.20827
#> 139  37 56.84227
#> 140  98 62.98783
#> 141  13 65.05859
#> 142  47 58.48647
#> 143  54 61.29451
#> 144  85 60.81049
#> 145   5 58.49860
#> 146   6 65.05246
#> 147  81 58.20827
#> 148  22 60.02838
#> 149   8 63.36101
#> 150  88 59.45687
#> 151   9 55.86871
#> 152  45 56.95071
#> 153  99 60.63920
#> 154  59 72.31685
#> 155  77 63.26339
#> 156  26 65.99518
#> 157  64 59.26415
#> 158  18 54.00308
#> 159  46 65.21969
#> 160  18 54.00308
#> 161  13 65.05859
#> 162  38 57.34284
#> 163  96 62.27801
#> 164  89 69.13893
#> 165  28 60.29380
#> 166  67 50.33553
#> 167  14 58.42614
#> 168  33 61.11303
#> 169  64 59.26415
#> 170  46 65.21969
#> 171  72 52.91797
#> 172  91 64.72991
#> 173  12 58.25723
#> 174  65 53.62949
#> 175  86 61.77975
#> 176  38 57.34284
#> 177  64 59.26415
#> 178  48 67.08641
#> 179  18 54.00308
#> 180  53 64.86068
#> 181  16 53.20849
#> 182  67 50.33553
#> 183  17 67.86464
#> 184  52 61.88323
#> 185  10 58.54052
#> 186  52 61.88323
#> 187   5 58.49860
#> 188  84 60.45348
#> 189  30 59.36833
#> 190  26 65.99518
#> 191  41 63.37635
#> 192  65 53.62949
#> 193  96 62.27801
#> 194  36 48.52603
#> 195  64 59.26415
#> 196  84 60.45348
#> 197  16 53.20849
#> 198  98 62.98783
#> 199  10 58.54052
#> 200  26 65.99518