Blog

  • vector -> lapply -> list array, matrix …

    vector -> lapply -> list
    array, matrix -> apply -> vector, array, list

  • Using a value of a variable in title …

    Using a value of a variable in title

    Use paste and eval.

    plot(x, main = paste("Cluster", eval(i))
    
  • LaTeX document spelling checker in Linux …

    LaTeX document spelling checker in Linux
    aspell check –mode=tex

  • Gene expression database http://smd.sta …

    Gene expression database
    http://smd.stanford.edu/

  • Links: Clustering methods in R Cluste …

    Links: Clustering methods in R

    Clustering using standard R functions
    http://www.statmethods.net/advstats/cluster.html

    Using heatmat and heatmap.2
    http://www2.warwick.ac.uk/fac/sci/moac/students/peter_cock/r/heatmap/

    Drawing k-means clusters on heatmap and introducing pheatmap
    http://stackoverflow.com/questions/5084077/r-draw-kmeans-clustering-with-heatmap

  • Calling R from Perl Statistics::R ht …

    Calling R from Perl

    Statistics::R

    Synopsis

     use Statistics::R;
      my $R = Statistics::R->new();
      $R->startR;
      $R->send(q`postscript("file.ps" , horizontal=FALSE , width=500 , height=500 , pointsize=1)`);
      $R->send(q`plot(c(1, 5, 10), type = "l")`);
      $R->send(q`dev.off()`);
      $R->send(qq`x = 123 \n print(x)`);
      my $ret = $R->read;
      print "\$ret : $ret\n";
      $R->stopR();
    
  • Very nice summary of editing in vim Eff …

    Very nice summary of editing in vim
    Efficient Editing with vim
    http://jmcpherson.org/editing.html

  • R global variables. This is one of th …

    R global variables.

    This is one of the annoying features of R. What it means is this. You defined a function. And accidentally there is an undefined variable in the function. Then R does not stop but keep looking for the variable and use one if there is one in the environment that called the function. It makes debugging very hard.

    Here is how to minimize it.

    1. Use codetools to scan your function.

    Codetools

    2. Use a prefix for all your variables in a function so that any mistakes can be seen easily.

    Hope to write more about it later but now, just want to post a solution.

  • Mendeley is a very nice reference manage …

    Export aggregated annotations from Mendeley.

    Mendeley is a very nice reference manager. It has many useful features but still some are missing, e.g. aggregating and exporting annotations of the selected references.
    Fortunately, Mendeley uses sqlite to store the data. In linux, the data is stores in the ~/.local/share/data/Mendeley Ltd./Mendeley Desktop directory.
    Open the sqlite file starting with your Mendeley id with a sqlite tool, then you can extract the annotations to a file.

    Here is an example. It exports all notes (annotations) in a folder named ‘Lab’.
    This is a rudimentary sql but it will give you the idea how it works. You may want to edit it depending on your needs.

    Also it is possible to connect the sqlite database from Excel and import the data directly into Excel, which may be more useful. I haven’t tried it by myself, though.

    select i.citationKey, i.title, i.note, i2.name
    from (
            select d.id, d.citationKey, d.title, n.note
    	from Documents as d
    	join FileNotes as n
    	on n.documentId = d.id
    	) as i
    join 
    	(select df.folderId, f.name, df.documentid 
    		from Folders as f
    		join DocumentFolders as df
    		on f.id = df.folderId
    	) as i2
    		
    on i.id = i2.documentid
    where i2.name = 'Lab'
    ;