general_commands
This is an old revision of the document!
general commands
[]: subscript a stringas.matrix.data.frame(data): convert data to a matriximage.plot(x, y, matrix): color matrix (library(filds))attach, detach: open/close tableread.table(…):skip=n: begin to read rows after n rowsrow.names=n: the row names are in column nfill=TRUE: show missing valuesna.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- 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)legend.lab: write a legend in image.plotdimnames(matrix) ← list(row names, col names): name rows and columns in a matrixlas: rotation of text margins
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)