楼主: xiangweinn
1436 0

[问答] 3个耶鲁大学R程序设计题目求助 [推广有奖]

  • 1关注
  • 28粉丝

副教授

52%

还不是VIP/贵宾

-

威望
0
论坛币
8879 个
通用积分
0.3300
学术水平
32 点
热心指数
58 点
信用等级
25 点
经验
34409 点
帖子
531
精华
1
在线时间
634 小时
注册时间
2010-11-14
最后登录
2023-7-18

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

R程序设计题目求助,同学们可以练练手,看看名校的题目是不是很难?

做出的同学可以回贴以附件形式出售,50个币以内购买。

(b)   (i) Write code to create three vectors Time, Status and Funded with values as in the table below. Time should be numeric, Status should be a factor with the levels which occur in the table, and Funded should be a logical vector.


Time Status Funded



1.5 Planned TRUE


2.3 Commenced FALSE


5.8 Commenced TRUE


3.4 Completed TRUE


(ii) Write code to create a data frame named Prajects containing these vectors as named columns.


(iii) Write code which uses sapply to find out which columns of Praj ects are numeric.



(iv) What would be the format of the output of the call to sapply?


(v) Write code to create a table of the values in the second column of the data frame.



(c) Write a function named UnifarmMean which has a single argument sampleSize with default value 100. The function should obtain a sample of size sampleSize from the uniform distribu tion on the unit interval using the function runif and return the mean of the sample.


(d) Write a function named Unifarmlnterval which has arguments intervalSize, with de fault value 0.05, and maxIter, the maximum number of iterations to perform, with default value 1000. The function should repeatedly call UnifarmMean with a sampleSize of 1, until either the mean of all the samples obtained is within intervalSize of 0.5 or maxlter iter ations have been completed. If it stops before the maximum number of iterations has been completed, it should display, with appropriate text, the number of times UnifarmMean has been called, and return this number. If it stops because the maximum number of iterations has been completed, it should display a message to this effect and returnmaxlter.


二维码

扫码加我 拉你入群

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

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

关键词:耶鲁大学 程序设计 R程序 appropriate iterations should factor 程序设计 耶鲁大学 frame

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-27 23:55