User Tools

Site Tools


r-tutorial

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
r-tutorial [2011/10/12 23:57]
liuyipei
r-tutorial [2011/10/13 00:00]
liuyipei
Line 280: Line 280:
 load(file="my.image.RData" load(file="my.image.RData"
 ls() ls()
-     
  
-# source - read and execute from a text file containing an R script+</code>
  
-# Debugging - Two main options 
-# Sprinkle cat(...) liberally throughout your code to monitor what is going on. 
-# debug(), undebug() - Turn on/off step through debugging for a function 
  
-# SIMPLE STATISTICS +====Basics====
-# Some simple statistics - note that many functions that perform statistical tests +
-# etc, in R return list objects.   +
-help(t.test) +
-ttest.result <- t.test(my.data['Hairless',] ~ pheno.data$plays.tuba) +
-ttest.result +
-names(ttest.result) +
-ttest.result$statistic +
-ttest.result$p.value +
- +
-help(cor.test) +
-cor.results <- cor.test(my.data['Hedgehog',], my.data['Shaggy',], method="spearman"+
- +
-help(chisq.test) +
-chisq.results <- chisq.test(pheno.data$rides.bike, pheno.data$plays.tuba) +
-chisq.results <- chisq.test(table(pheno.data$rides.bike, pheno.data$plays.tuba)) +
- +
-help(prcomp) +
-prcomp.results <- prcomp(my.data) +
-my.data[is.na(my.data)] <- 0 +
-prcomp.results <- prcomp(my.data) +
- +
-</code>+
r-tutorial.txt · Last modified: 2011/10/15 12:05 by liuyipei