Re: [R] Problem with sample(...,size = 1000000000,...)

2016-10-15 Thread jim holtman
I forgot to add that if you have less than 16GB of memory, then you were probably paging memory to disk and that would have take a much, much, longer time. When you are trying to do something BIG, do it in some smaller steps and look at the resources that it takes (memory, cpu, ...). Jim Holtman

Re: [R] Problem with sample(...,size = 1000000000,...)

2016-10-15 Thread jim holtman
Do you realize you are trying to create a vector with 1 billion entries, so this will take some time. How much memory do you have on your computer? Here are some times to generate increasing sample sizes. I have 16GB on my computer and it took only 30 seconds to generate the data and used almost

[R] Problem with sample(...,size = 1000000000,...)

2016-10-15 Thread Huy Nguyễn
When I ran this code: " x<-sample(1:5,10,TRUE,c(0.1,0.2,0.4,0.2,0.1)) print(table(x)/10) plot(table(x)/10,type="h",xlab="x",ylab="P(x)") " My laptop was frozen and didn't respond. Although I used ctrl+alt+del to terminate r program, my laptop still did nothing. And I must re