Title | Assignment 1 - R programming Questions |
---|---|
Author | Dixon Ah_Di |
Course | Programming Languages for Statistics |
Institution | 香港中文大學 |
Pages | 3 |
File Size | 170.6 KB |
File Type | |
Total Downloads | 76 |
Total Views | 147 |
R programming Questions...
STAT2005ProgrammingLanguagesforStatistics Assignment1 Due:30September2020,5pm 1. Using rep() and seq() as needed to create the following vectors. (The use of c() functionisprohibitedinthisquestion.) (a)10 12 14 16 18 20 22 24 26 28 30 (b)1 2 3 4 5 2 3 4 5 6 3 4 5 6 7 4 5 6 7 8 5 6 7 8 9 1(a). seq(10,30, by=2) (b). rep(seq(1:5)+rep(0:4,each=5)) 2.SearchforanRfunctionthatsolvestherootsofpolynomialequations. (a)Findallrootsofthefollowingequationandsaveitasroots.
5x 5 4x 4 3x 3 2x 2 x 0. (b)Whatisthemodeofroots?
numeric/complex
(c)Useasinglelinecommandtosortthevaluesinrootsbyascendingorderofits imaginarypart. (Note:theimaginarypartofacomplexnumbera+biisb,where𝑖 √1.Youcanreadthe helpdocumentoftheorder()functionbyenteringhelp(order).)
roots...