Statistical Computing with R: A tutorial 0.1. What is R?R is a software package especially suitable for data analysis and graphical representation. Functions and results of analysis are all stored as objects, allowing easy function modification and model building. It is very flexible and highly customizable. On the other hand, R has a few weaknesses. 0.2 Where do I get R? and follow the download instructions. 0.3 Invoking RIf properly installed, usually R has a shortcut icon on the desktop screen and/or you can find it under Start|Programs|R menu. To quit R, type q() at the R prompt (>) and press Enter key. Commands you entered can be easily recalled and modified. Interactive graphics can serve as a great learning tool. Effect of kernel choice, sample size and bandwidth can be conveniently illustrated by the following demonstration: 2.1 ComputationFirst of all, R can be used as an ordinary calculator. 2.2 VectorR handles vector objects quite easily and intuitively. When finished, click
Visualizing data using a 3D printer In a break from my usual obsessions and interests here is a guest blog post by Ian Walker. I'm posting it because I think it is rather cool and hope it will be of interest to some of my regular readers. Ian is perhaps best known (in the blogosphere) for his work on transport psychology - particularly cycling - but is also an expert on psychological statistics. Some time ago, I had some data that lent themselves to a three-dimensional surface plot. Of course, displaying fundamentally three-dimensional items in two dimensions is an ancient problem, as any cartographer will tell you. I managed to meet up with Adrian back in May 2012, and he explained to me the structure of the STL (stereolithography) files commonly used for three-dimensional printing. I'm normally a terrible hacker when it comes to programming; I usually storm in and try to make things work as quickly as possible then fix all the mistakes later. Demo source('r2stl.r') x <- seq(-10, 10, length= 100) y <- x z <- outer(x, y, f)
R for Psych Research This is one page of a series of tutorials for using R in psychological research. Much of material has also covered been covered in number of short courses or in a set of tutorials for specific problems. This particular page is an update of a previous guide to R which is being converted to HTML5 to be more readable. (For a very abbreviated form of this guide meant to help students do basic data analysis in a personality research course, see a very short guide. There are many possible statistical programs that can be used in psychological research. It has been claimed that "The statistical programming language and computing environment S has become the de-facto standard among statisticians. The R project, based upon the S and S+ stats packages, has developed an extremely powerful set of "packages" that operate within one program. Although many run R as a language and programming environment, there are Graphical User Interfaces (GUIs) available for PCs, Linux and Macs. Back to Top entering ?
The MakeR way: Using R to reify social media data via 3d printing If you’ve read any of my previous posts you know that I am constantly experimenting with different ways to represent and explore social network data with R. For example, in previous posts I’ve written about sonification of tweet data, animation of dynamic twitter networks, and various ways to plot social networks (here and here). In each case the underlying idea is finding different ways to explore data under the assumption that sometimes just looking at something from a different point of view reveals something novel. First, why would anyone want to take network data, model it in 3D and then use a 3D printer to make it real? So how did I use R in this project? edge.list.df <- data.frame(from=retweeters, to=retweeted) g <- graph.data.frame(edge.list.df, directed=TRUE) Now that I have the network, I can use the features of the igraph package to set the size and colors of the nodes and edges (code not shown, but you can see an example here). writeSTL("~myNetworkPrintFile.stl")
R Programming - Manuals R Basics The R & BioConductor manual provides a general introduction to the usage of the R environment and its basic command syntax. Code Editors for R Several excellent code editors are available that provide functionalities like R syntax highlighting, auto code indenting and utilities to send code/functions to the R console. Programming in R using Vim or Emacs Programming in R using RStudio Integrating R with Vim and Tmux Users interested in integrating R with vim and tmux may want to consult the Vim-R-Tmux configuration page. Finding Help Reference list on R programming (selection)R Programming for Bioinformatics, by Robert GentlemanAdvanced R, by Hadley WickhamS Programming, by W. Control Structures Conditional Executions Comparison Operators equal: ==not equal: ! Logical Operators If Statements If statements operate on length-one logical vectors. Syntax if(cond1=true) { cmd1 } else { cmd2 } Example if(1==0) { print(1) } else { print(2) } [1] 2 Avoid inserting newlines between '} else'. Loops Syntax
The R programming language for programmers coming from other programming languages IntroductionAssignment and underscoreVariable name gotchasVectorsSequencesTypesBoolean operatorsListsMatricesMissing values and NaNsCommentsFunctionsScopeMisc.Other resources Ukrainian translation Other languages: Powered by Translate Introduction I have written software professionally in perhaps a dozen programming languages, and the hardest language for me to learn has been R. R is more than a programming language. This document is a work in progress. Assignment and underscore The assignment operator in R is <- as in e <- m*c^2. It is also possible, though uncommon, to reverse the arrow and put the receiving variable on the right, as in m*c^2 -> e. It is sometimes possible to use = for assignment, though I don't understand when this is and is not allowed. However, when supplying default function arguments or calling functions with named arguments, you must use the = operator and cannot use the arrow. At some time in the past R, or its ancestor S, used underscore as assignment. Vectors Sequences
R Beginner's Guide and R Bloggers Updates 1/1/2011 Update: Tal Galili wrote an article that revisits the first year of R-Bloggers and this post was listed as one of the top 14. Therefore, I decided to make a small update to each section. I start by describing the initial series of tutorials that I wrote. A few more have been added since and even more planned in the upcoming year. As always, an up to date listing of my articles can be found on the R Tutorial Series blog. New posts will also continue to be offered through the R Bloggers network. Since October 2009, I have written 13 articles [many more now, of course] for the R Tutorial Series blog. Introduction to R Descriptive Statistics Summary and Descriptive Statistics Data Visualization Scatterplots Correlation Zero-Order Correlations Regression I also have two additional R-related items to update you on. 1/1/2011 Update: I originally reported that 50 blogs composed the R Bloggers network. R Tutorial Series on R Bloggers R Beginner's Guide
Cookbook for R » Cookbook for R R Programming Language | ProgrammingR Impatient R Translations français: Translated by Kate Bondareva. Serbo-Croatian: Translated by Jovana Milutinovich from Geeks Education. Preface This is a tutorial (previously known as “Some hints for the R beginner”) for beginning to learn the R programming language. You are probably impatient to learn R — most people are. This page has several sections, they can be put into the four categories: General, Objects, Actions, Help. General Introduction Blank screen syndrome Misconceptions because of a previous language Helpful computer environments R vocabulary Epilogue Objects Key objects Reading data into R Seeing objects Saving objects Magic functions, magic objects Some file types Packages Actions What happens at R startup Key actions Errors and such Graphics Vectorization Make mistakes on purpose Help Introduction I asked R users what their biggest stumbling blocks were in learning R. > search()