Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含值分布的文本文件,每行一个,例如:
2313213.32 321233.23 97938.23 21323 211555
如何从这个分布中随机抽样 1000 次,并从这个随机抽样中获得平均值?最好使用R。
先感谢您,
鲁巴尔
#test<-readLines('your.file') #test<-as.numeric(test) test<-c(2313213.32,321233.23,97938.23,21323,211555) out<-sample(test,1000,replace=TRUE) out.mean<-mean(out) > out.mean [1] 618679.5