haotu : an open lab notebook


plot rho correlation in R

Filed under: R, R graphics, R Stats — S @ 13:28
text(.2,-.4,bquote(rho == .(cr)),cex=2)

Order Boxplot in R

Filed under: R, R graphics, R Stats — S @ 11:58

I have found that this plotting function orders boxes in alphabetical order, at times, so if I want a particular order that the R god is not giving me, then I find it easiest to rename my categories in an alphabetical order in which I want plotted and then us the names argument to relabel the x-axis.  



add row to data frame when there are factors

Filed under: Manipulate Data in R, R, R Stats — Tags: , , — S @ 06:49

In general I do not like factors in my data frames, and while there are good reasons to have them, my work typically does not require it. So when trying to amend or add to data frames using rbind these hidden factors cause problems. The easiest solution I have found is to turn those factors into character vectors using the following code.


i <- sapply(df.coords, is.factor)
df.coords[i] <- lapply(df.coords[i], as.character)


install all packages from task view in R

Filed under: R, R Stats — Tags: , , — S @ 08:13

Use the ctv package to install all of the packages that are listed in an R taskview


Blog at WordPress.com.