Imperial College/Courses/Fall2009/Synthetic Biology (MRes class)/'R' Tutorial/Basic Commands: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
No edit summary
No edit summary
Line 41: Line 41:
* '''Exit R'''
* '''Exit R'''
** type q() in 'R' console
** type q() in 'R' console
* '''Getting help'''
** Check online tutorials (see above)
** Type help(command_name) or ?command_name like help(length), ?length
* '''Objects in R'''
* '''Objects in R'''
** > Types available
** > Data Types available
*** integer
*** numeric
*** character
*** complex
*** logical
** > Data Structures available
*** Vectors
*** Matrices
*** Factors
*** Lists
*** Data Frames
** > Listing objects in memory
** > Listing objects in memory
*** type objects() in 'R' console.
*** type objects() in 'R' console.
Line 48: Line 62:
*** type rm(object_name)
*** type rm(object_name)
*** to clear all memory type rm(objects())
*** to clear all memory type rm(objects())
* '''Getting help'''
** Check online tutorials (see above)
** Type help(command_name) or ?command_name like help(length), ?length

Revision as of 03:34, 5 October 2009

Fall 2009 - Synthetic Biology (MRes class)

Home        Lecture        'R' Tutorial        Resources        Literature

<html> <body> <!-- Start of StatCounter Code --> <script type="text/javascript"> var sc_project=3315864; var sc_invisible=0; var sc_partition=36; var sc_security="8bb2efcd"; </script>

<script type="text/javascript" src="http://www.statcounter.com/counter/counter_xhtml.js"></script><noscript><div class="statcounter"><a class="statcounter" href="http://www.statcounter.com/"><img class="statcounter" src="http://c37.statcounter.com/3315864/0/8bb2efcd/0/" alt="blog stats" /></a></div></noscript> <!-- End of StatCounter Code -->

</body> </html>

Introduction to 'R'




Useful online resources

Crash Course in R

  • Running R
    • > Starting R
      • Find and Select 'R' within your Programs list
    • > Running 'R' from command line
      • Once started, 'R' will open an interactive console.
      • You can then type 'R' commands. Remember, 'R' commands are case sensitive.
      • Commands are separated either by a semi-colon (‘;’), or by a newline.
      • The vertical arrow keys on the keyboard can be used to scroll forward and backward through a command history.
    • > Running 'R' From a script (strongly suggested)
      • 'R' can runs commands that have been saved in a text file (you can use your prefered text editor)
      • Commands are separated either by a semi-colon (‘;’), or by a newline.
      • For good practice, comments should be added to the script by using '#', like '# this is my comment'
      • to execute the script, type in the 'R' console source("path_to_my_script/my_script.R")
  • Exit R
    • type q() in 'R' console
  • Getting help
    • Check online tutorials (see above)
    • Type help(command_name) or ?command_name like help(length), ?length
  • Objects in R
    • > Data Types available
      • integer
      • numeric
      • character
      • complex
      • logical
    • > Data Structures available
      • Vectors
      • Matrices
      • Factors
      • Lists
      • Data Frames
    • > Listing objects in memory
      • type objects() in 'R' console.
    • > Clearing memory
      • type rm(object_name)
      • to clear all memory type rm(objects())