Categories
status

Perl resources Perl Training Australia Perl Tips http…

Perl resources

Perl Training Australia – Perl Tips
http://perltraining.com.au/tips/

Modern Perl
http://onyxneon.com/books/modern_perl/modern_perl_letter.pdf

Categories
status

Treemap in R 1 Portpolio package Pros Quick…

Treemap in R

1. Portpolio package
Pros: Quick, simple, bigger output
Cons: One color scheme

An Easy Way to Make a Treemap

2. Treemap package
Pros: More customization, several algorithms
Cons: smaller output size

http://cran.r-project.org/web/packages/treemap/treemap.pdf

Remarks:
Index must be factor.
Different types
comp: (size – color) / color
dens: color / size

Categories
status

Makefile to use with Pandoc using pattern rules…

Makefile to use with Pandoc using pattern rules.

OUTPUT = ../output

%.docx: %.mdown
    pandoc -s --biblio bibliography.bib --csl cell.csl -o $(OUTPUT)/$@ $<
%.tex: %.mdown
    pandoc -s --biblio bibliography.bib --csl cell.csl -o $(OUTPUT)/$@ $<

Usage:

make introduction.docx

Adapted from
http://stackoverflow.com/questions/6577176/makefiles-and-wildcards

Categories
status

Referring a figure in Pandoc + LaTeX This…

Referring a figure in Pandoc + LaTeX

This will put the label inside of a caption which is recommended.

![This is the caption\label{mylabel}](/url/of/image.png)
See figure \ref{mylabel}.

http://stackoverflow.com/questions/9434536/how-do-i-make-a-reference-to-a-figure-in-markdown-using-pandoc

Categories
status

rsync snapshot backup using link dest option The…

rsync snapshot backup using –link-dest option.

The rsync option –link-dest is very useful for Timemachine like snapshop backup.
It compares the source with the files in the –link-dest then if the files were not changed make a hard link to them. So without using extra drive space, it can keep the snapshop copy.
When the sync source is a Samba drive, sometimes the –link-dest option does not work as expected because of the permission difference, especially the -a (archive) option is used.
The -a option is composite of -rltpgoD options.
By removing the permission (-p) check, if it’s alright, the –link-dest works properly.

rsync -rltgoDvzhH --progress -e ssh --link-dest=/home/user/dest1 source/ dest2/
Categories
status

Customize the color order and label of the…

Customize the color, order and label of the legend in ggplot2
Use scale_colour_manual()

scale_colour_manual(values = c("red", "blue"), breaks = c("S2", "S1"), labels = c("sample1", "sample2"))

http://had.co.nz/ggplot2/scale_manual.html

Categories
status

ggplot2 opts list https github com hadley ggplot2…

ggplot2 opts list

https://github.com/hadley/ggplot2/wiki/%2Bopts%28%29-List

Categories
status

Sometimes R gives the error message Error in…

Sometimes R gives the error message.

Error in X11(d$display, d$width, d$height, d$pointsize, d$gamma, d$colortype,  : 
  unable to start device X11cairo

Here is the fix.

Sys.setenv("DISPLAY"=":0.0")
Categories
status

Display file contents with file names tail +1…

Display file contents with file names;

tail +1 many_files*

It works on Mac, BSD.

For GNU tail, use

tail -n +1 many_files*

Update: GNU tail has different parameters.

http://stackoverflow.com/questions/5917413/cat-multiple-files-but-include-filename-as-headers