User Tools

Site Tools


general_commands

Differences

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

Link to this comparison view

Next revision
Previous revision
general_commands [2007/12/21 11:50] – created heidigeneral_commands [2011/03/07 16:54] (current) heidi
Line 1: Line 1:
 ====== general commands ====== ====== general commands ======
 +  * ''install.packages("packageName")'': download and install a package --> start R as following: ''Rgui.exe --internet2''
 +  * ''help(package=XML)'': information about the package XML
 +  * ''str(a)'': display the structure of a object
 +  * ''table(x)'': returns a table with the numbers of the different values of x
   * ''[]'': subscript a string   * ''[]'': subscript a string
   * ''as.matrix.data.frame(''data'')'': convert data to a matrix   * ''as.matrix.data.frame(''data'')'': convert data to a matrix
Line 6: Line 10:
   * ''read.table(...)'':    * ''read.table(...)'': 
     * ''skip=n'': begin to read rows after n rows     * ''skip=n'': begin to read rows after n rows
-    * ''row.names=n'': the row names are in column n +    * ''row.names=n'': the row names are in column n or a vector giving the actual row names 
 +    * ''nrows=n'': read maximal n rows
     * ''fill=TRUE'': show missing values     * ''fill=TRUE'': show missing values
-    * ''na.strings="''N.A.''""'': transform N.A. in NA (missing values)+    * ''na.strings="''N.A.''"'': transform N.A. in NA (missing values)
   * ''for(i in 1:ncol(''data'')) if(is.numeric(''data''[,i])) ''data''[is.na(''data''[,i]),i] <- 0'': transform all NA to 0   * ''for(i in 1:ncol(''data'')) if(is.numeric(''data''[,i])) ''data''[is.na(''data''[,i]),i] <- 0'': transform all NA to 0
   * object ''<- cbind(''object, as.matrix("newColumn")'')'': add new column or row(''rbind'') to an existing matrix    * object ''<- cbind(''object, as.matrix("newColumn")'')'': add new column or row(''rbind'') to an existing matrix 
   * ''byrow=TRUE'' (in matrix): makes the matrix row by row (instead of column by column)   * ''byrow=TRUE'' (in matrix): makes the matrix row by row (instead of column by column)
   * ''legend.lab'': write a legend in image.plot   * ''legend.lab'': write a legend in image.plot
 +    * better way: ''legend.args=list( text="''legend text''", cex=1.0, side=4, line=2)''
 +
   * ''dimnames(''matrix'') <- list(''row names, col names'')'': name rows and columns in a matrix   * ''dimnames(''matrix'') <- list(''row names, col names'')'': name rows and columns in a matrix
   * ''las'': rotation of text margins   * ''las'': rotation of text margins
 +  * ''par(...)'': can be used to set or query graphical parameters
 +    * ''mar'': A numerical vector of the form ''c(bottom, left, top, right)'' which gives the number of lines of margin to be specified on the four sides of the plot. The default is ''c(5, 4, 4, 2) + 0.1''
 +    * ''mfcol, mfrow'': A vector of the form ''c(nr, nc)''. Subsequent figures will be drawn in an nr-by-nc array on the device by columns (mfcol), or rows (mfrow), respectively. Consider the alternatives, layout and split.screen. 
 +    * ''mfg'': A numerical vector of the form ''c(i, j)'' where i and j indicate which figure in an array of figures is to be drawn next (if setting) or is being drawn (if enquiring). The array must already have been set by mfcol or mfrow. 
 +
 +
 +
  
-legend.args=list( text="Number of different Allels (FST)", 
-cex=1.0, side=4, line=2) 
  
general_commands.1198234205.txt.gz · Last modified: 2008/07/22 13:30 (external edit)