{"id":325,"date":"2014-08-27T14:28:52","date_gmt":"2014-08-27T21:28:52","guid":{"rendered":"https:\/\/blogs.ubc.ca\/coetoolbox\/?page_id=325"},"modified":"2016-08-31T11:26:55","modified_gmt":"2016-08-31T18:26:55","slug":"getting-started-with-r","status":"publish","type":"page","link":"https:\/\/blogs.ubc.ca\/coetoolbox\/summarizing-data\/getting-started-with-r\/","title":{"rendered":"Getting started with R"},"content":{"rendered":"<p><a href=\"http:\/\/en.wikipedia.org\/wiki\/R_%28programming_language%29\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright\" src=\"http:\/\/upload.wikimedia.org\/wikipedia\/commons\/thumb\/1\/1b\/R_logo.svg\/200px-R_logo.svg.png\" alt=\"R (programming language)\" width=\"200\" height=\"152\" \/><\/a>R is a wonderful tool for data analysis. You\u2019re almost guaranteed to need to be very proficient in it for your project.<\/p>\n<p>R is great for cleaning data because it lets you keep track of the specific steps you used (and ideally write scripts to automate or replicate the process). It also has hugely powerful statistical capabilities, as well as a huge range of graphing capabilities. R\u2019s strength comes from its status as freeware: developers are constantly releasing new packages (that you can download and install) that let R do new and interesting things. \u00a0Its limitations: It is not a database management system, even though it can do basic joins (called merge in R). Also, since all data are loaded into working memory, there are limits to the size of the data files it can work with (though there are some workarounds)\u2014it\u2019s not the ideal tool for \u201cbig data\u201d. Finally, its capabilities for interactive graphics are recent and limited. Within these boundaries, though, it\u2019s amazing\u2014and free!<\/p>\n<p>Because it\u2019s such a powerful flexible tool, there can be a steep learning curve. Here are some things to get you started.<\/p>\n<p><strong>Install R: <\/strong>there are <a href=\"http:\/\/www.r-project.org\/\">versions <\/a>for different operating systems.<\/p>\n<p><strong>Install R Studio: <\/strong>this is a nice <a href=\"http:\/\/www.rstudio.com\/products\/rstudio\/download\/\">editing environment<\/a>: it lets you keep track of scripts, plot windows, the objects in your environment, and so forth. There is no reason not to use R Studio if you&#8217;re using R. If you launch R Studio it will start an R session automatically&#8211;you don&#8217;t need to start both.<\/p>\n<p><strong>Start learning:\u00a0 <\/strong><em>swirl<\/em> is a package that turns the R console into an interactive learning environment.\u00a0This <a href=\"http:\/\/swirlstats.com\/\">site<\/a>\u00a0has instructions on installing it and loading \u201ccourses\u201d.<\/p>\n<p>For an alternative approach, you might want to check out the video lectures in the Coursera class \u201cR Programming\u201d (offered monthly) \u2013it will walk you through how to install packages and write scripts in R. (This class is part of the Data Science specialization on Coursera; all of the classes are worth taking.)<\/p>\n<p><strong>Use reference sheets and tutorials:<\/strong> The R Studio homepage has a number of handy reference sheets. Here are few of them:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.rstudio.com\/wp-content\/uploads\/2015\/02\/data-wrangling-cheatsheet.pdf\">data wrangling with dplyr and tidyr<\/a><\/li>\n<li><a href=\"http:\/\/www.rstudio.com\/wp-content\/uploads\/2015\/12\/ggplot2-cheatsheet-2.0.pdf\">data visualization with ggplot<\/a><\/li>\n<li>integrated analysis and reporting with <a href=\"http:\/\/www.rstudio.com\/wp-content\/uploads\/2015\/02\/rmarkdown-cheatsheet.pdf\">r markdown<\/a><\/li>\n<\/ul>\n<p>A great walkthrough of using the reshape2 package to change the layout of data is <a href=\"http:\/\/seananderson.ca\/2013\/10\/19\/reshape.html\">here<\/a>.<\/p>\n<p><strong>Find answers to specific questions:<\/strong> Googling the thing you\u2019re interested in will turn up lots of results. You can also browse the archives at\u00a0<a href=\"http:\/\/www.r-bloggers.com\/\">R Bloggers<\/a>\u00a0or <a href=\"http:\/\/stackoverflow.com\/\">Stack Overflow<\/a>.<\/p>\n<p><strong>Get inspired: <\/strong>This <a href=\"http:\/\/www.r-statistics.com\/tag\/visualization\/\">blog <\/a>has some nice examples of data visualization in R.\u00a0This <a href=\"http:\/\/flowingdata.com\/\">blog <\/a>has nice examples of data visualization in general. This <a href=\"http:\/\/viz.wtf\/\">blog <\/a>has examples of what NOT to do with data visualization.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>R is a wonderful tool for data analysis. You\u2019re almost guaranteed to need to be very proficient in it for your project. R is great for cleaning data because it lets you keep track of the specific steps you used (and ideally write scripts to automate or replicate the process). It also has hugely powerful [&hellip;]<\/p>\n","protected":false},"author":22979,"featured_media":0,"parent":548,"menu_order":3,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-325","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/pages\/325","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/users\/22979"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/comments?post=325"}],"version-history":[{"count":8,"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/pages\/325\/revisions"}],"predecessor-version":[{"id":1469,"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/pages\/325\/revisions\/1469"}],"up":[{"embeddable":true,"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/pages\/548"}],"wp:attachment":[{"href":"https:\/\/blogs.ubc.ca\/coetoolbox\/wp-json\/wp\/v2\/media?parent=325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}