search for: datbig

Displaying 1 result from an estimated 1 matches for "datbig".

2010 Aug 18
5
ifelse command
hello people, I want to make a biased dice using the sample() function and print out the results after n number of runs, I've successfully generated the dice using the following command: mydie2<-function(n=1000,y=NULL,...){ for(i in 1:n){ x<-sample(1:6,n,replace=TRUE,prob=c(1,1,2,3,2,1)/10) x=runif(n) if(x<=1/10){y[i]=1} else if(x<=2/10){y[i]=2} else if(x<=4/10){y[i]=3} else