[R] context of runif()
Duncan Murdoch
murdoch.duncan at gmail.com
Wed Feb 13 21:23:50 CET 2013
On 13/02/2013 1:26 PM, Charles Determan Jr wrote:
> Greetings,
>
> I am exploring some random forest analysis methods and have come upon one
> aspect I don't fully understand from any manual. The code of interest is
> as follows from the randomForest package:
>
> myiris=cbind(iris[1:4], matrix(runif(508*nrow(iris)),nrow(iris),508))
>
> This would be following by the rfcv() function for cross-validation but I
> am confused about the former syntax.
>
> My question is why 508? Is this some arbitrary number that one just
> chooses are is there some logic to the choice? I have looked through the
> package documentation and the runif() help which tells me that runif(n,
> min=0, max=1):
> n=length of observations
> min&max = lower and upper limits
>
> I still don't follow exactly what is taking place here.
The code constructs a 508 column matrix and fills it with random uniform
values. 508*nrow(iris) is just a count of how many entries there are in
the matrix, it has nothing to do with runif() per se.
So you'll need to look elsewhere to find why they thought they needed
508 columns.
Duncan Murdoch
More information about the R-help
mailing list