Difference between revisions of "R tutorial"

From Organic Design wiki
m (Command prompt)
m (Twenty tasks to do in R)
Line 22: Line 22:
  
 
====Twenty tasks to do in R====
 
====Twenty tasks to do in R====
 
 
Use  a contributed guide as a template fo a list of twenty tasks to do. It must cover;
 
Use  a contributed guide as a template fo a list of twenty tasks to do. It must cover;
 +
----
 +
* Obtaining help in R
 +
help.start()          <font color="red"># Browser based help documentation</font>
 +
help()                <font color="red"># Help on a topic</font>
 +
? ls                  <font color="red"># alternative help method on ''ls'' function</font>
 +
apropos(mean)          <font color="red"># Find Objects by (Partial) Name</font>
 +
example(mean)          <font color="red"># Run an Examples Section from the Online Help</font>
 +
demo()                <font color="red"># Demonstrations of R Functionality</font>
 +
demo(graphics)        <font color="red"># Demonstration or graphics Functionality</font>
 +
data()                <font color="red"># Publically available datasets</font>
 
----
 
----
 
* Useful commands in the R environment
 
* Useful commands in the R environment
Line 33: Line 42:
 
  save.image()          <font color="red"># Save R Objects</font>
 
  save.image()          <font color="red"># Save R Objects</font>
 
  q()                  <font color="red"># Terminate an R Session &rarr;  prompted to Save workspace image? [y/n/c]:</font>
 
  q()                  <font color="red"># Terminate an R Session &rarr;  prompted to Save workspace image? [y/n/c]:</font>
 
+
----
 
** Memory based, can write to &rarr; .RData file  
 
** Memory based, can write to &rarr; .RData file  
 
;*File handling
 
;*File handling

Revision as of 22:48, 14 March 2006

TODO

Tasks available from web which utilze example data available in R - object assignment, subsetting, plotting, mathematical functions, sorting etc (20 tasks?)
  • Usage/interaction within environment
  • Bioconductor resources/vignettes(including downloading)
  • Bioconductor basics (any resources for limma out there?)

Resources

Command prompt

  • Type commands after the prompt (>) e.g.
> x <- 1:10        # assignment of 1 to 10 to an object called x
> x
 [1]  1  2  3  4  5  6  7  8  9 10
  • Continuation of commands is expected after the plus symbol (+) e.g.
> x <- 1: 
+  10
> x
 [1]  1  2  3  4  5  6  7  8  9 10

Twenty tasks to do in R

Use a contributed guide as a template fo a list of twenty tasks to do. It must cover;


  • Obtaining help in R
help.start()           # Browser based help documentation
help()                 # Help on a topic
? ls                   # alternative help method on ls function
apropos(mean)          # Find Objects by (Partial) Name
example(mean)          # Run an Examples Section from the Online Help
demo()                 # Demonstrations of R Functionality
demo(graphics)         # Demonstration or graphics Functionality
data()                 # Publically available datasets

  • Useful commands in the R environment
search()              # Give Search Path for R Objects
searchpaths()         # Give Full Search Path for R Objects
ls()                  # List objects
objects()             # alternate function to list objects
rm(list=ls())         # Remove Objects from a Specified Environment
save.image()          # Save R Objects
q()                   # Terminate an R Session →  prompted to Save workspace image? [y/n/c]:

    • Memory based, can write to → .RData file
  • File handling
  • Object creation
  • Different types of data
  • Quiting R
  • Recommended contributed guide/reference card
Contributed material
  • usingR-2.pdf Chapter 1 → Starting up.
  • MGEDI → installing R/Bioconductor p30 - p34 (documentation/help)


  1. Create a vector
  2. Create a matrix
  3. Create a list
  4. Subsetting/Indexing
  5. Indexing from a vector
  6. Indexing from a matrix
  7. Indexing from a list
  8. Plotting data
  9. Labelling/colours etc
  10. Ab lines?
  11. how to read help
  12. Apropos/example/demo/find etc
  13. Help example
  14. ls/rm
  15. quit