答案 0 :(得分:-1)
很抱歉早些时候的愚蠢回复,我这就是你要找的东西:
Population=as.integer(runif(4000,10000,1000000))
df <- matrix(runif(16000,0,1), nc=4)
df <- sweep(df, 1, rowSums(df), FUN="/")
df=as.data.frame(df)
df=cbind(Population,df)
colnames(df)=c('Population','0-24','25-64','64-85','85 above')
df1=cbind(Population,round(df$Population*df[,2:5],0))