{"id":247,"date":"2014-06-19T09:39:10","date_gmt":"2014-06-19T17:39:10","guid":{"rendered":"http:\/\/research.engineering.ucdavis.edu\/biosport\/?page_id=247"},"modified":"2014-06-19T09:39:50","modified_gmt":"2014-06-19T17:39:50","slug":"r","status":"publish","type":"page","link":"https:\/\/research.engineering.ucdavis.edu\/biosport\/sample-page\/lab-meetings\/r\/","title":{"rendered":"R"},"content":{"rendered":"<p>Basic information on R, an open source statistical software.<\/p>\n<dl id=\"document-toc\">\n<dt>Contents<\/dt>\n<dd>\n<ol>\n<li><a href=\"http:\/\/biosport.ucdavis.edu\/lab-meetings\/r#section-0\">What Is R?<\/a><\/li>\n<li><a href=\"http:\/\/biosport.ucdavis.edu\/lab-meetings\/r#section-1\">General Links<\/a><\/li>\n<li><a href=\"http:\/\/biosport.ucdavis.edu\/lab-meetings\/r#section-2\">Get R<\/a><\/li>\n<li><a href=\"http:\/\/biosport.ucdavis.edu\/lab-meetings\/r#section-3\">Documentation And Tutorials<\/a><\/li>\n<li><a href=\"http:\/\/biosport.ucdavis.edu\/lab-meetings\/r#section-4\">GUIs For R<\/a><\/li>\n<li><a href=\"http:\/\/biosport.ucdavis.edu\/lab-meetings\/r#section-5\">Basic Code<\/a><\/li>\n<li><a href=\"http:\/\/biosport.ucdavis.edu\/lab-meetings\/r#section-6\">Python And R<\/a><\/li>\n<\/ol>\n<\/dd>\n<\/dl>\n<div id=\"parent-fieldname-text\"><a name=\"section-0\"><\/a><\/p>\n<h2>What is R?<\/h2>\n<p>R is a open source high level programming language designed specifically for statistical computation and graphics. It is one of the most used stat programs by statisticians and is comparable (or better!) than many proprietary stats programs.<\/p>\n<p><a name=\"section-1\"><\/a><\/p>\n<h2>General Links<\/h2>\n<p>The R Project Homepage:\u00a0<a href=\"http:\/\/www.r-project.org\/\">http:\/\/www.r-project.org\/<\/a><\/p>\n<p>The R Journal:\u00a0<a href=\"http:\/\/journal.r-project.org\/\">http:\/\/journal.r-project.org\/<\/a><\/p>\n<p>R on Wikipedia:\u00a0<a href=\"http:\/\/en.wikipedia.org\/wiki\/R_%28programming_language%29\">http:\/\/en.wikipedia.org\/wiki\/R_%28programming_language%29<\/a><\/p>\n<p>OpenWetWare R info:\u00a0<a href=\"http:\/\/openwetware.org\/wiki\/R_Statistics\">http:\/\/openwetware.org\/wiki\/R_Statistics<\/a><\/p>\n<p>Crantastic, a review site for R packages:\u00a0<a href=\"http:\/\/crantastic.org\/\">http:\/\/crantastic.org\/<\/a><\/p>\n<p><a href=\"http:\/\/onertipaday.blogspot.com\/\">http:\/\/onertipaday.blogspot.com\/<\/a><\/p>\n<p><a href=\"http:\/\/www.nytimes.com\/2009\/01\/07\/technology\/business-computing\/07program.html\">New York Times Article<\/a><\/p>\n<p><a name=\"section-2\"><\/a><\/p>\n<h2>Get R<\/h2>\n<p>Download R:\u00a0<a href=\"http:\/\/cran.r-project.org\/\">http:\/\/cran.r-project.org\/<\/a>\u00a0(R can also be found in most Linux distribution repositories.)<\/p>\n<p>How to install R:\u00a0<a href=\"http:\/\/cran.r-project.org\/doc\/FAQ\/R-FAQ.html#How-can-R-be-installed_003f\">http:\/\/cran.r-project.org\/doc\/FAQ\/R-FAQ.html#How-can-R-be-installed_003f<\/a><\/p>\n<p><a name=\"section-3\"><\/a><\/p>\n<h2>Documentation and Tutorials<\/h2>\n<ul>\n<li>Official R documentation compilation:\u00a0<a href=\"http:\/\/cran.r-project.org\/manuals.html\">http:\/\/cran.r-project.org\/manuals.html<\/a><\/li>\n<li>R Tutorial by Kelly Black:\u00a0<a href=\"http:\/\/www.cyclismo.org\/tutorial\/R\/\">http:\/\/www.cyclismo.org\/tutorial\/R\/<\/a><\/li>\n<li>Math 356 R Tutorial:\u00a0<a href=\"http:\/\/math.illinoisstate.edu\/dhkim\/rstuff\/rtutor.html\">http:\/\/math.illinoisstate.edu\/dhkim\/rstuff\/rtutor.html<\/a><\/li>\n<li>R for Programmers:\u00a0<a href=\"http:\/\/heather.cs.ucdavis.edu\/~matloff\/r.html\">http:\/\/heather.cs.ucdavis.edu\/~matloff\/r.html<\/a>\u00a0(not complete in the sense that the needed data files aren&#8217;t provided to reproduce the code)<\/li>\n<li>Practical Regression and Anova using R:\u00a0<a href=\"http:\/\/cran.r-project.org\/doc\/contrib\/Faraway-PRA.pdf\">http:\/\/cran.r-project.org\/doc\/contrib\/Faraway-PRA.pdf<\/a>(excellent tutorial!)<\/li>\n<li><a href=\"http:\/\/www.statmethods.net\/\">http:\/\/www.statmethods.net\/<\/a><\/li>\n<li><a href=\"http:\/\/www.mayin.org\/ajayshah\/KB\/R\/index.html\">R by example\u00a0<\/a><\/li>\n<li><a href=\"http:\/\/rgm2.lab.nig.ac.jp\/RGM2\/images.php?show=all&amp;pageID=1032\">R Graphical Manual<\/a><\/li>\n<li><a href=\"http:\/\/www.johndcook.com\/R_language_for_programmers.html\">R programming for those coming from other languages<\/a><\/li>\n<li><a href=\"http:\/\/google-styleguide.googlecode.com\/svn\/trunk\/google-r-style.html\">Style guide from Google<\/a><\/li>\n<\/ul>\n<div><a name=\"section-4\"><\/a><\/p>\n<h2>GUIs for R<\/h2>\n<p>JGR\u00a0<a href=\"http:\/\/jgr.markushelbig.org\/JGR.html\">http:\/\/jgr.markushelbig.org\/JGR.html<\/a><\/p>\n<p>R Commander\u00a0<a href=\"http:\/\/socserv.mcmaster.ca\/jfox\/Misc\/Rcmdr\/\">http:\/\/socserv.mcmaster.ca\/jfox\/Misc\/Rcmdr\/<\/a><\/p>\n<p><a name=\"section-5\"><\/a><\/p>\n<h2>Basic code<\/h2>\n<pre># declare a vector\r\n&gt; x &lt;- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)\r\n# write a custom function for the square of a number\r\n&gt; sq &lt;- function(x) x*x\r\n&gt; sq(5)\r\n[1] 25\r\n&gt; y &lt;- sq(x)                             \r\n&gt; y                                    \r\n [1]   1   4   9  16  25  36  49  64  81 100\r\n# make a scatter plot\r\n&gt; plot(y ~ x)<\/pre>\n<dl>\n<dt><a href=\"http:\/\/biosport.ucdavis.edu\/lab-meetings\/xsquared.png\" rel=\"lightbox\"><img loading=\"lazy\" decoding=\"async\" title=\"xsquared.png\" alt=\"xsquared.png\" src=\"http:\/\/biosport.ucdavis.edu\/lab-meetings\/xsquared.png\/image_preview\" width=\"400\" height=\"400\" \/><\/a><\/dt>\n<dd><\/dd>\n<\/dl>\n<pre># calculate the mean and variance of y\r\n&gt; mean(y)            \r\n[1] 38.5             \r\n&gt; var(y)             \r\n[1] 1167.833\r\n# fit a linear regression model\r\n&gt; summary(lm(y ~ x)) \r\n\r\nCall:\r\nlm(formula = y ~ x)\r\n\r\nResiduals:\r\n   Min     1Q Median     3Q    Max \r\n    -8     -6     -2      4     12 \r\n\r\nCoefficients:\r\n            Estimate Std. Error t value Pr(&gt;|t|)\r\n(Intercept) -22.0000     5.5498  -3.964  0.00415 **\r\nx            11.0000     0.8944  12.298 1.78e-06 ***\r\n---\r\nSignif. codes:  0 \u2018***\u2019 0.001 \u2018**\u2019 0.01 \u2018*\u2019 0.05 \u2018.\u2019 0.1 \u2018 \u2019 1\r\n\r\nResidual standard error: 8.124 on 8 degrees of freedom\r\nMultiple R-squared: 0.9498,     Adjusted R-squared: 0.9435\r\nF-statistic: 151.2 on 1 and 8 DF,  p-value: 1.778e-06\r\n# add the regression line to the plot\r\n&gt; abline(lm(y ~ x))<\/pre>\n<dl>\n<dt><a href=\"http:\/\/biosport.ucdavis.edu\/lab-meetings\/xsqReg.png\" rel=\"lightbox\"><img loading=\"lazy\" decoding=\"async\" title=\"xsqReg.png\" alt=\"xsqReg.png\" src=\"http:\/\/biosport.ucdavis.edu\/lab-meetings\/xsqReg.png\/image_preview\" width=\"400\" height=\"400\" \/><\/a><\/dt>\n<dd><\/dd>\n<\/dl>\n<pre># make some diagnostic plots for the fit\r\n&gt; par(mfrow=c(2, 2))\r\n&gt; plot(lm(y ~ x))<\/pre>\n<dl>\n<dt><a href=\"http:\/\/biosport.ucdavis.edu\/lab-meetings\/resid.png\" rel=\"lightbox\"><img loading=\"lazy\" decoding=\"async\" title=\"resid.png\" alt=\"resid.png\" src=\"http:\/\/biosport.ucdavis.edu\/lab-meetings\/resid.png\/image_preview\" width=\"400\" height=\"400\" \/><\/a><\/dt>\n<dd><\/dd>\n<\/dl>\n<p><a name=\"section-6\"><\/a><\/p>\n<h2>Python and R<\/h2>\n<p>RPy\u00a0<a href=\"http:\/\/rpy.sourceforge.net\/index.html\">http:\/\/rpy.sourceforge.net\/index.html<\/a><\/p>\n<p>R\/SPlus &#8211; Python Interface\u00a0<a href=\"http:\/\/www.omegahat.org\/RSPython\/\">http:\/\/www.omegahat.org\/RSPython\/<\/a><\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Basic information on R, an open source statistical software. Contents What Is R? General Links Get R Documentation And Tutorials GUIs For R Basic Code Python And R What is R? R is a open source high level programming language designed specifically for statistical computation and graphics. It is one \u2026 <a class=\"continue-reading-link\" href=\"https:\/\/research.engineering.ucdavis.edu\/biosport\/sample-page\/lab-meetings\/r\/\"> Continue reading <span class=\"meta-nav\">&rarr; <\/span><\/a><\/p>\n","protected":false},"author":10,"featured_media":0,"parent":29,"menu_order":7,"comment_status":"closed","ping_status":"closed","template":"","meta":{"ngg_post_thumbnail":0,"footnotes":""},"class_list":["post-247","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/research.engineering.ucdavis.edu\/biosport\/wp-json\/wp\/v2\/pages\/247","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/research.engineering.ucdavis.edu\/biosport\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/research.engineering.ucdavis.edu\/biosport\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/research.engineering.ucdavis.edu\/biosport\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/research.engineering.ucdavis.edu\/biosport\/wp-json\/wp\/v2\/comments?post=247"}],"version-history":[{"count":0,"href":"https:\/\/research.engineering.ucdavis.edu\/biosport\/wp-json\/wp\/v2\/pages\/247\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/research.engineering.ucdavis.edu\/biosport\/wp-json\/wp\/v2\/pages\/29"}],"wp:attachment":[{"href":"https:\/\/research.engineering.ucdavis.edu\/biosport\/wp-json\/wp\/v2\/media?parent=247"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}