Blog

  • Read text file into R as a character vec …

    Read text file into R as a character vector.

    genome.sequence <- scan(file = sequence.file, what = "character")

  • LaTeX version control todonotes http …

    LaTeX version control

    Aller ici todonotes

    http://midtiby.blogspot.com/2008/07/todonotes-version-2008-07-28.html

    Todo notes
    Todo notes

    Good for leaving comments.
    Image placeholder.

    découvrez ici maintenant trackchanges

    http://trackchanges.sourceforge.net/index.html

    track changes
    Track changes footnote
    Track changes inline
    track changes margins
    Track changes margins

    Margin, footnote, inline options to display the changes.
    GUI to accept changes. Python installation is required.

    essayez ce site changes

    http://www.ctan.org/tex-archive/macros/latex/contrib/changes

    changes
    Changes inline
    changes options
    Changes draft options

    Draft and final options. Easy to make final output without running another utility or scripts.

    latexdiff

    http://www.pppl.gov/~hammett/comp/tex/latexdiff.html

    latex diff
    LaTeX Diff output

    Edit the LaTeX source file without extra tags so the source remains clean.
    This Perl script generates another LaTeX file for review.
    Perl installation is required.

  • Using rsync to sync files rsync avh source…

    Using rsync to sync files.

    rsync -avh source_folder/ target_folder/
    
    • -a: archive mode
    • -v: verbose
    • -h: human readable

    Additional options

    • -u: update only (preserve newer files)
    • -H: preserve the hard link
    • –progress: shows progress
    • -n: dry run (without actual copying)

    By the way, “/home/user/dir/” and “/home/usr/dir” are not the same thing to rsync. Without the final slash, rsync will copy the directory in its entirety. With the trailing slash, it will copy the contents of the directory but won’t recreate the directory.

    For more explanations, check this nice post.

    http://www.linux.com/news/enterprise/storage/8200-back-up-like-an-expert-with-rsync

  • R graph by examples http://rgraphics.li …

    R graph by examples
    http://rgraphics.limnology.wisc.edu/index.php

  • functions depending on the data types in …

    functions depending on the data types in R
    [table id=1 /]

  • Differences in single argument subscript …

    Differences in single argument subscripting in matrix and data frame.
    Even though the two variables look similar, the results are different depending on the data type.
    The single argument scripting of data frame returns a column, while matrix returns an element according to its position as matrix is a vector.

    > class(my2)
    [1] "data.frame"
    > my2
      a1  b  c a1.1
    1 10 20 30   35
    2 10 20 30   35
    > my2[1]
      a1
    1 10
    2 10
    > class(my2.matrix)
    [1] "matrix"
    > my2.matrix
      a1  b  c a1.1
    1 10 20 30   35
    1 10 20 30   35
    > my2.matrix[1]
    [1] 10 
    
  • Prevent drop dimension attribute by drop …

    Prevent drop dimension attribute by drop = FALSE.

    test.matrix <- matrix(1:15, nc=5)
    > test.matrix[1, ]
    [1]  1  4  7 10 13
    > test.matrix[1, , drop=FALSE]
         [,1] [,2] [,3] [,4] [,5]
    [1,]    1    4    7   10   13
    
  • Subscripting in R * [ gives the same …

    Subscripting in R

    [ gives the same data type as the data it is applied to.
    [[ and $ extract the element and the data type is not necessarily the same as that of the data it is applied to.

    $ does partial matching.
    [ and [[ don’t.

    $ does not evaluate.
    [ and [[ evaluate their arguments.

  • declare a list and adding an element in …

    declare a list and adding an element in R

    test.list <- list()
    test.list[['key']] <- value  # adding an element
    test.list[['key']]  # retrieve the element
    
  • Tiling a big image into smaller ones usi …

    Tiling a big image into smaller ones using ImageMagick

    convert -density 200 -crop 100x100 remodelling.pdf remodelling_tile%d.png