Off topic:R sampling command size not correct
0
0
Entering edit mode
9.1 years ago
John ▴ 70
> ratio[i]
[1] 0.9

> length(sample(c(1,2,3,4,5,6,7,8,9),2000*ratio[i],replace=T))

[1] 1800
> length(sample(c(1,2,3,4,5,6,7,8,9),2000*(1-ratio[i]),replace=T))
[1] 199

Could someone help me figure out why the third command didn't return 200? Thanks!

R • 984 views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 2735 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6