Evalulate expression n times then combine results into an array
raply(.n, .expr, .progress = "none", .drop = TRUE)
.n | number of times to evaluate the expression |
---|---|
.expr | expression to evaluate |
.progress | name of the progress bar to use, see |
.drop | should extra dimensions of length 1 be dropped, simplifying the output. Defaults to |
if results are atomic with same type and dimensionality, a vector, matrix or array; otherwise, a list-array (a list with dimensions)
This function runs an expression multiple times, and combines the
result into a data frame. If there are no results, then this function
returns a vector of length 0 (vector(0)
).
This function is equivalent to replicate
, but will always
return results as a vector, matrix or array.
Hadley Wickham (2011). The Split-Apply-Combine Strategy for Data Analysis. Journal of Statistical Software, 40(1), 1-29. http://www.jstatsoft.org/v40/i01/.
#> [1] 0.5584955 0.4697370 0.4822532 0.5305808 0.5377929 0.4881434 0.5381100 #> [8] 0.4703026 0.5472282 0.4935907 0.4952039 0.4839420 0.5138925 0.4327108 #> [15] 0.4688585 0.5252160 0.5253965 0.4718530 0.4846889 0.4451547 0.5268910 #> [22] 0.5137286 0.4906905 0.5082787 0.4739030 0.5015941 0.5305796 0.4748503 #> [29] 0.5220966 0.5346173 0.4899333 0.4792032 0.4698322 0.4609836 0.4723003 #> [36] 0.5433753 0.4762456 0.4902146 0.4785824 0.4964821 0.4854702 0.4597122 #> [43] 0.4461904 0.5131031 0.5121412 0.4940802 0.4946290 0.4743156 0.5248818 #> [50] 0.5638900 0.4820735 0.5043396 0.5463671 0.5407433 0.4644628 0.5068428 #> [57] 0.4820315 0.5153432 0.5178457 0.5197146 0.4941293 0.4959801 0.5069841 #> [64] 0.4783945 0.4552871 0.4552612 0.5027126 0.4955604 0.5412673 0.5189458 #> [71] 0.5015168 0.4429296 0.5418324 0.4546798 0.4767133 0.5676088 0.4873053 #> [78] 0.5176180 0.4695523 0.4387623 0.5689078 0.5131628 0.4832881 0.4821332 #> [85] 0.5258128 0.5188157 0.5388142 0.5231157 0.5218042 0.5554773 0.4771688 #> [92] 0.5270716 0.5156222 0.4588663 0.5291597 0.5041095 0.4705824 0.4556904 #> [99] 0.5876905 0.5139431#> mean var #> [1,] 0.5064787 0.09021675 #> [2,] 0.5222287 0.07982721 #> [3,] 0.5002795 0.07679700 #> [4,] 0.4403795 0.08527059 #> [5,] 0.5768071 0.08834411 #> [6,] 0.4904158 0.07663819 #> [7,] 0.5582532 0.10447992 #> [8,] 0.5062552 0.07693396 #> [9,] 0.5400883 0.07151249 #> [10,] 0.5155815 0.08577656 #> [11,] 0.4426911 0.07847692 #> [12,] 0.5148081 0.08126050 #> [13,] 0.5296468 0.08506841 #> [14,] 0.4931644 0.07433117 #> [15,] 0.5433389 0.08772457 #> [16,] 0.4776649 0.08191829 #> [17,] 0.4769341 0.09080778 #> [18,] 0.5146941 0.08305615 #> [19,] 0.5110821 0.07343913 #> [20,] 0.5075705 0.07275980 #> [21,] 0.4900907 0.09737132 #> [22,] 0.4612607 0.08595145 #> [23,] 0.4491314 0.07709163 #> [24,] 0.5587151 0.06810705 #> [25,] 0.4817064 0.09346954 #> [26,] 0.4774691 0.07466746 #> [27,] 0.4682821 0.08319741 #> [28,] 0.4843510 0.09205859 #> [29,] 0.5105021 0.08332798 #> [30,] 0.5364541 0.07954959 #> [31,] 0.5125006 0.09704554 #> [32,] 0.4674663 0.08826359 #> [33,] 0.5013050 0.09193559 #> [34,] 0.5072940 0.07669015 #> [35,] 0.4873498 0.07698108 #> [36,] 0.5123859 0.07942558 #> [37,] 0.5349697 0.10539271 #> [38,] 0.4798644 0.08764293 #> [39,] 0.4830029 0.08383848 #> [40,] 0.4878720 0.08896036 #> [41,] 0.4600546 0.08585740 #> [42,] 0.4895523 0.06848075 #> [43,] 0.4841702 0.08800731 #> [44,] 0.5326503 0.09800090 #> [45,] 0.5179845 0.07593739 #> [46,] 0.4829349 0.07971595 #> [47,] 0.5006757 0.07488661 #> [48,] 0.4918405 0.08106829 #> [49,] 0.4964587 0.08937489 #> [50,] 0.4464064 0.07566823 #> [51,] 0.4923931 0.07025832 #> [52,] 0.4726734 0.08606211 #> [53,] 0.4851818 0.08386350 #> [54,] 0.4978580 0.08815816 #> [55,] 0.4668338 0.07695100 #> [56,] 0.4399210 0.09181129 #> [57,] 0.5112859 0.07759263 #> [58,] 0.4882721 0.08871280 #> [59,] 0.4919637 0.08360487 #> [60,] 0.4641138 0.08458284 #> [61,] 0.5419229 0.08094339 #> [62,] 0.4978082 0.09316553 #> [63,] 0.5503442 0.07506029 #> [64,] 0.4920230 0.08141070 #> [65,] 0.4977952 0.08393787 #> [66,] 0.4920332 0.08967688 #> [67,] 0.5046889 0.07816585 #> [68,] 0.5100983 0.09149569 #> [69,] 0.5486922 0.08244488 #> [70,] 0.5133056 0.07832304 #> [71,] 0.5794162 0.07911560 #> [72,] 0.5015504 0.09281853 #> [73,] 0.4949633 0.08409770 #> [74,] 0.5643648 0.07531413 #> [75,] 0.5024826 0.08841003 #> [76,] 0.5081734 0.07739172 #> [77,] 0.5370159 0.08291375 #> [78,] 0.4890444 0.07785362 #> [79,] 0.5126101 0.08873069 #> [80,] 0.5126939 0.07547086 #> [81,] 0.5378120 0.07980691 #> [82,] 0.5138487 0.07923766 #> [83,] 0.5132048 0.08222338 #> [84,] 0.4601113 0.07988469 #> [85,] 0.5339971 0.08385979 #> [86,] 0.4573957 0.08061159 #> [87,] 0.4596440 0.08407839 #> [88,] 0.4950845 0.08552175 #> [89,] 0.4911690 0.07275004 #> [90,] 0.5307175 0.08123803 #> [91,] 0.4885752 0.09477539 #> [92,] 0.4841624 0.08715988 #> [93,] 0.4489604 0.09313719 #> [94,] 0.4919678 0.07736353 #> [95,] 0.5207776 0.08348864 #> [96,] 0.5086462 0.07340560 #> [97,] 0.5231152 0.07866158 #> [98,] 0.4887706 0.07695537 #> [99,] 0.4379047 0.08020732 #> [100,] 0.4811070 0.08384652#> 1 2 3 4 #> [1,] 0.54145249 0.8907091 0.32151545 0.1250310 #> [2,] 0.66251793 0.9076187 0.06790063 0.3817729 #> [3,] 0.09742514 0.2887907 0.42288886 0.4029146 #> [4,] 0.26808516 0.1966407 0.40262705 0.7738335 #> [5,] 0.51317455 0.2063446 0.34925567 0.9825930 #> [6,] 0.41201474 0.9733992 0.20484583 0.5971397 #> [7,] 0.84129918 0.2892940 0.62101429 0.7080306 #> [8,] 0.55622021 0.9469919 0.31842539 0.5562842 #> [9,] 0.40948053 0.5751130 0.51273323 0.8527832 #> [10,] 0.90699040 0.4192694 0.82711846 0.9345553#> , , 1 #> #> 1 2 #> [1,] 0.30128874 0.44078373 #> [2,] 0.45309542 0.13070042 #> [3,] 0.97522098 0.85046352 #> [4,] 0.74889236 0.69268308 #> [5,] 0.93545440 0.94320610 #> [6,] 0.79375497 0.60836588 #> [7,] 0.07492938 0.01811218 #> [8,] 0.92322266 0.75240169 #> [9,] 0.72741335 0.72724533 #> [10,] 0.38768796 0.77172367 #> #> , , 2 #> #> 1 2 #> [1,] 0.06584878 0.15140966 #> [2,] 0.91119418 0.95694045 #> [3,] 0.43453848 0.98714552 #> [4,] 0.69394622 0.99208567 #> [5,] 0.62401968 0.46227475 #> [6,] 0.45477137 0.60268634 #> [7,] 0.09800884 0.94325154 #> [8,] 0.22652712 0.39899366 #> [9,] 0.94387626 0.09961407 #> [10,] 0.46811674 0.69185158 #>