{"id":264,"date":"2007-10-02T23:10:50","date_gmt":"2007-10-02T22:10:50","guid":{"rendered":"http:\/\/www.decisionsciencenews.com\/?p=264"},"modified":"2012-03-13T23:59:53","modified_gmt":"2012-03-14T03:59:53","slug":"r-video-tutorial-number-2","status":"publish","type":"post","link":"https:\/\/www.decisionsciencenews.com\/?p=264","title":{"rendered":"R video tutorial number 2"},"content":{"rendered":"<p>READ TEXT FILES, RUN MODELS<\/p>\n<p style=\"text-align: center\"><a href=\"http:\/\/www.youtube.com\/watch?v=GcmorHXygoI\" target=\"_blank\"><img decoding=\"async\" src=\"http:\/\/www.decisionsciencenews.com\/wp-content\/uploads\/2007\/09\/rtut2.gif\" alt=\"rtut2.gif\" \/><\/a><\/p>\n<p>The Decision Science News R video tutorials continue with <a href=\"http:\/\/www.youtube.com\/watch?v=GcmorHXygoI\" target=\"_blank\">number 2<\/a>.  (If you missed that last one, you will want to watch <a href=\"http:\/\/www.decisionsciencenews.com\/?p=261\">R Video Tutorial Number 1<\/a> first.) The Goldstein pedometer dataset can be downloaded from <a href=\"http:\/\/www.dangoldstein.com\/flash\/Rtutorial2\/pedometer.csv\" onclick=\"javascript:urchinTracker ('\/downloads\/Pedometer');\">http:\/\/www.dangoldstein.com\/flash\/Rtutorial2\/pedometer.csv<\/a><\/p>\n<p>High Res Version: <a href=\"http:\/\/www.dangoldstein.com\/flash\/Rtutorial2\/Rtutorial2.html\">http:\/\/www.dangoldstein.com\/flash\/Rtutorial2\/Rtutorial2.html<\/a><\/p>\n<p>Topics covered this week include:<\/p>\n<ul>\n<li>Tricking R into starting in your working directory<\/li>\n<li>Reading in text files<\/li>\n<li>Accessing columns in data frames<\/li>\n<li>Creating histograms<\/li>\n<li>Side effects and optional parameters of function calls<\/li>\n<li>Fitting simple linear models<\/li>\n<li>Adding least-squares and loess lines to plots<\/li>\n<\/ul>\n<p>The commands in the tutorial are:<br \/>\n<code><br \/>\nmyData=read.table(\"pedometer.csv\", header=TRUE, sep=\",\")<br \/>\nx=hist(myData$Steps,col=\"lightblue\")<br \/>\nx=hist(myData$Steps,breaks=20,col=\"lightblue\")<br \/>\nplot(myData$Steps ~ myData$Observation,col=\"blue\")<br \/>\nmyModel=lm(myData$Steps ~ myData$Observation)<br \/>\nsummary(myModel)<br \/>\nlines(fitted(myModel))<br \/>\nlines(fitted(loess(myModel)),col=\"red\")<br \/>\n<\/code><\/p>\n<p><font size=\"1\">Can&#8217;t view flash? Download <a href=\"http:\/\/www.dangoldstein.com\/flash\/Rtutorial2\/RTut2Movie.avi\">movie<\/a> If you see no image under Windows, download the TSSC <a href=\"http:\/\/www.techsmith.com\/download\/codecs.asp\">Codec<\/a><\/font>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>READ TEXT FILES, RUN MODELS The Decision Science News R video tutorials continue with number 2. (If you missed that last one, you will want to watch R Video Tutorial Number 1 first.) The Goldstein pedometer dataset can be downloaded from http:\/\/www.dangoldstein.com\/flash\/Rtutorial2\/pedometer.csv High Res Version: http:\/\/www.dangoldstein.com\/flash\/Rtutorial2\/Rtutorial2.html Topics covered this week include: Tricking R into starting [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[4,74],"tags":[1208,70],"class_list":["post-264","post","type-post","status-publish","format-standard","hentry","category-encyclopedia","category-r","tag-r","tag-statistics"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4LKj-4g","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.decisionsciencenews.com\/index.php?rest_route=\/wp\/v2\/posts\/264","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.decisionsciencenews.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.decisionsciencenews.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.decisionsciencenews.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.decisionsciencenews.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=264"}],"version-history":[{"count":8,"href":"https:\/\/www.decisionsciencenews.com\/index.php?rest_route=\/wp\/v2\/posts\/264\/revisions"}],"predecessor-version":[{"id":685,"href":"https:\/\/www.decisionsciencenews.com\/index.php?rest_route=\/wp\/v2\/posts\/264\/revisions\/685"}],"wp:attachment":[{"href":"https:\/\/www.decisionsciencenews.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=264"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.decisionsciencenews.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=264"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.decisionsciencenews.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=264"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}