全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
1253 2
2017-06-01
Age should be generated from 2 to 20 based on the below command for 2000 subjects:

AGE=round(runif(2000,2,20),1)

However, I would like to generate these 2000 subjects with
29% subjects from age 2 to 4
17% subjects from age 5 to 9
24% subjects from age 10 to 14
30% subjects from age 15 to 20

Is there a smart way to do this? Thanks!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2017-6-1 07:30:56
复制代码
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2017-8-23 05:24:22
a pediatric population should be generated from 2 to 20 based on the below command for 2000 subjects:

NID=2000
TM<-
data.frame(ID=seq(1,NID,by=1),AGEM=round(runif(NID,2,20)*12,1),SEX=rep(1:2,each=round(NID/2)))

However, I would like to generate these 2000 subjects with
34% subjects from age 2 to 10
66% subjects from age 11 to 20

Is there a smart way to do this and also keep original randomness? Thanks!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群