Archive for October, 2010

Plotting density in R

How to plot density plot(density(DATA)) Rainbow color in R If you want to make a plot have rainbow color range, you can use rainbow function: rcol=rainbow(length(YOURDATA)) plot(DATAX, DATAY, type=”l”) points(DATAX, DATAY, pch=16, col=rcol) Simple Plot How to change the size of text in a plot? Use argument cex.[attribute] , and examples are below: main titles […]

Read More →

Useful R syntax

Reading table of selected file from a broswer read.table(file.choose()) nrow (dat) # number of rows head (dat) # shows names and first few rows of dat paste(“hello”, “world”, sep=”-“) # hello-world source(mylibrary.R) # will import mylibrary content rep(NA, 5) # NA NA NA NA NA rep(1:4, 2) # 1 2 3 4 1 2 3 […]

Read More →