Monday, 13 October 2014

Histograms and density plots...

This is important:
reminder about how to draw both of these with R.

http://www.statmethods.net/graphs/density.html


Thursday, 9 October 2014

Importing directly from xlsx

So it is possible to read directly into R from xlsx.
It's not trivial but it does seem possible:
See info here:
http://stackoverflow.com/questions/7049272/importing-xlsx-file-into-r

more here:
http://www.milanor.net/blog/?p=779

and here:
http://www.r-bloggers.com/importexport-data-to-and-from-xlsx-files/

Monday, 6 October 2014

Simple graphs in R

This link: http://www.harding.edu/fmccown/r/ has some nice examples.

written by this guy: http://frankmccown.blogspot.co.uk/

However, for R for Biochemists, I think we really need some biochemical examples.

Ideally some:

  • Kd and Vmax
  • Time courses of protein production
  • Perhaps a simple protein assay
  • Need some correlation with statistics
  • Need some mean, standard deviation. 
  • Need some T-tests (one sided, paired), ANOVA
  • Want to do the multiple graph thing - very useful for data exploration.
  • Some grouping algorithms maybe?
  • Talk about good quality graphs
  • Publication quality. 

Interesting piece about R here:
http://stackoverflow.com/questions/3750153/relationship-between-plotting-packages-in-r

gnuplot vs R
http://www.manning-sandbox.com/thread.jspa?threadID=35427
gnuplot is just for graphing!
R is so much more!
Perhaps too much?

Friday, 3 October 2014

Using R - the easy way...

R is an open source statistics package. It's very powerful with lots of statistical models that can be used, lots of great graphics that can be made and most usefully - it's free. If you're interested in numbers, data, statistics, graphs, visualisations - R is one of the best tools there is.

I've spend the last number of months learning how to use R and today I want to give a primer on how to use R to do some simple things. Most of these are things that other packages can do - like Google Documents (but you need internet access) or Excel (but you have to pay for it) but you have to start with the easy stuff.

Your first calculation 
Step 1: Download R and unpack it.

Step 2: Download R-Studio and unpack it.

Step 3: Type the following simple text into R-studio:

>3+5

press return

you get:

[1] 8

You've just used R.

Your first graph

> x <- c(1,2,3,4)
> y <- c(2,4,6,8)
> plot(x,y)
>

Import a datafile
Customise a graph
Export a graph.


Using the top box.

Check out RStudio videos

Thursday, 2 October 2014

Making contour plots in R

I am wondering how to make contour plots in R because of a chat I had with Jim from Bath.

It looks very feasible and as usual there are many ways to do it.

Generally, a contour plot of this type has three different kinds of values:

  • a value for the X axis
  • a value for the Y axis
  • some kind of value for the colour. 
Often the X and Y axis are continuous while the colour is a little more categorical although it can be quite continuous. 

Searching, as you would, in Google gives some of the following sources:

https://stat.ethz.ch/R-manual/R-devel/library/graphics/html/contour.html

- some very interesting examples here. 

https://stat.ethz.ch/R-manual/R-devel/library/graphics/html/filled.contour.html

http://stackoverflow.com/questions/15869969/adding-a-color-key-to-contour-plots-in-r

Wednesday, 24 September 2014

1D histogram from Flow data AGAIN

plot(ntl, "FL4-A", breaks=10000, xlim=c(0,100000))

this "breaks" makes a real difference!


Links for R flow packages and info re 1D histogram

http://www.bioconductor.org/packages/release/bioc/manuals/flowViz/man/flowViz.pdf

http://www.bioconductor.org/packages/release/bioc/vignettes/flowCore/inst/doc/HowTo-flowCore.pdf


Found a little about how to plot 1D histograms:

plot(ntl, c("FL4-A"), breaks=10000, xlim=c(0, 100000))

Plot needs some kind of log transformation for sure.