Articles by Xianjun Dong

line width in R and in Illustrator

December 17, 2012 | Xianjun Dong

I've drawn figure in R with lwd=1, e.g.pdf('test.pdf')plot(1:10, type='o', lwd=2, axes=F)box(lwd=1, col='red')dev.off()And then you open the PDF in Illustrator, you will see the border width is 0.75pt, and the line is 1.5pt, which seems that the unit ... [Read more...]

draw figures in CMYK mode in R

October 31, 2012 | Xianjun Dong

Print publication usually ask to use CMYK (instead of RGB) color mode for figures (because not every color can be print out), while we usually use RGB for screen reading (because screen has larger range of color scale). Of course we can convert RGB to ... [Read more...]

difference between NA and NaN in R

August 23, 2012 | Xianjun Dong

We usually see NA and NaN in R. What's the difference between them?Here a good post for that topic:http://stats.stackexchange.com/questions/5686/what-is-the-difference-between-nan-and-naIn summary here:NaN ("Not a Number") means 0/0NA ("Not Available") is generally interpreted as a missing value and has various forms - NA_integer_, ... [Read more...]

bubble plot in R

July 18, 2012 | Xianjun Dong

Motived by the post from FlowingData(http://flowingdata.com/2010/11/23/how-to-make-bubble-charts/), I made this plot with R code below:par(mfrow=c(3,1), mar=c(4,6,4,4))for(ty in c("protein_coding","lincRNA","piRNA")){          ... [Read more...]

about boxplot

June 15, 2012 | Xianjun Dong

From Wiki:"... the bottom and top of the box are always the 25th and 75th percentile (the lower and upper quartiles, respectively), and the band near the middle of the box is always the 50th percentile (the median). But th... [Read more...]

whisker of boxplot

June 15, 2012 | Xianjun Dong

From Wiki:"... the bottom and top of the box are always the 25th and 75th percentile (the lower and upper quartiles, respectively), and the band near the middle of the box is always the 50th percentile (the median). But the ends of the whiskers can represent several possible alternative values..."... [Read more...]

match vs. %in%

November 4, 2011 | Xianjun Dong

match and %in% are two very commonly-used function in R. So, what's the difference of them?First, how to use them -- (copy from R manual)match returns a vector of the positions of (first) matches of its first argument in its second.%in% is a ... [Read more...]

single-column data frame

October 10, 2011 | Xianjun Dong

This is a trivial but very useful tip:__ x=data.frame(a=1:4, c=5)__ x a c1 1 52 2 53 3 54 4 5__ x[1,] a c1 1 5__ x[,1][1] 1 2 3 4__ x[,1, drop=F] a1 12 23 34 4where you can see that:to avoid a[, i] become a vector, rather than a... [Read more...]
1 2 3

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)