1 / 5

An introduction to R (cont)

An introduction to R (cont). Ståle Nygård ( staaln@math.uio.mo ) Department of Mathematics, University of Oslo 23.11.2007 Course in Statistical methods and bioinformatics for the analysis of microarray data. Packages in R. All R functions and datasets are stored in packages .

takara
Download Presentation

An introduction to R (cont)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. An introduction to R (cont) Ståle Nygård (staaln@math.uio.mo) Department of Mathematics, University of Oslo 23.11.2007 Course in Statistical methods and bioinformatics for the analysis of microarray data

  2. Packages in R • All R functions and datasets are stored in packages. • Some packages are standard, the rest has to be installed and loaded. • A package is installed (or updated) by • Going to Install package(s) in the R menu line or • Typing > install.packages() (or > update.packages() ) • To see which packages are installed at your site, issue the command > library() with no arguments. • Only when a package is loaded are its contents available.To load a particular package (e.g. the bioconductor affy package), use a command like > library(affy) • To see which packages are currently loaded, use > search() to display the search list.

  3. Contributed packages and CRAN • There are hundreds of contributed packages for R, written by many different authors. • Some of these packages implement specialized statistical methods, others give access to data or hardware, and others are designed to complement textbooks. • Some (the recommended packages) are distributed with every binary distribution of R. Most are available for download from CRAN (http://CRAN.R-project.org/ and its mirrors), and other repositories such as Bioconductor (http://www.bioconductor.org/).

  4. Working directories • To set the working directory to e.g. C:/microarray, type > setwd(”C:/microarray”) (If you have a file microdata.txt stored in C:/microarray, you can then load the file by e.g. typing data=read.table(”microdata.txt”)) • To find your current directory, type > getwd() • It is recommended that you should use separate working directories for different analyses conducted with R

  5. Workspaces • During an R session, objects (variables, functions etc.) are created and stored by name. The collection of objects currently stored is called the workspace. The R command > objects() (alternatively, ls()) can be used to display the names of (most of) the objects which are currently stored within R. • At the end of each R session you are given the opportunity to save the workspace. If you indicate that you want to do this, the objects are written to a file called .RData in the current directory, and the command lines used in the session are saved to a file called .Rhistory. • When R is started at later time from the same directory it reloads the workspace and the associated commands history is reloaded from this file.

More Related