View on GitHub

Neural Dynamics R Tutorial

Download this project as a .zip file Download this project as a tar.gz file

NDL R Tutorial

author: Ryan Mears date: March 24, 2014 transition: linear

Overview

Working with data in R with the RStudio GUI

Installing R and RStudio

type: section

R

Install R

The R Foundation for Statistical Computing

RStudio

Install RStudio

RStudio

Get and Shape Data

type: section

Reading Data and Code

getwd()
getwd()

Data and Code in R

Create variables

hc_subjs <- c('sbj101','sbj102','sbj105')
sz_subjs <- c('sbj103','sbj104','sbj106')

Create variables

x <- seq_len(6)
subjs <- c(hc_subjs,sz_subjs)
cbind(x,subjs)

Create variables

  hc_2 <- cbind(hc_subjs,"hc")
  sz_2 <- cbind(sz_subjs,"sz")
  sz_2

 grp_subjs <- rbind(hc_2,sz_2)
  colnames(grp_subjs)<-c("subj","group")
  grp_subjs

Examine variables

print(hc_subjs)
length(hc_subjs)
dim(grp_subjs)

str(grp_subjs)

Index and Select

grp_subjs[1,1]
grp_subjs[1,]

grp_subjs[,2]=='hc'

Index and Select

Convert and Combine

Subset and Reshape

Analyze and Summarize

type: section

Compute Parameters

Compare Means

ANOVA

plot(cars)

Explore and Present

type: section

Plot

Present Results for Publication

Dynamic Documents

Resources

type: subsection