Tuesday, September 23, 2014

see the version number of mac on command line

$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.9.5
BuildVersion: 13F34

Saturday, September 6, 2014

list function in an R package

> ls('package:rstan')

Monday, June 23, 2014

latex resizebox in a minipage for tabular with a caption

We can put tabular to resizebox to easily resize a table in latex. 

If it's in a minipage environment, we might need caption package to add captions. 

Thursday, June 12, 2014

paste: combine files horizontally

PASTE(1)                  BSD General Commands Manual                 PASTE(1)

NAME
     paste -- merge corresponding or subsequent lines of files

SYNOPSIS
     paste [-s] [-d list] file ...

Wednesday, April 30, 2014

count a character in each line

for example, if I want to check if a CSV file without quotes is valid, something like the following might help:

tr -d -c ',\n' < file | awk '{print length;}' | uniq


Friday, April 25, 2014

capture.output function in R

Once I was wondering how to return string from function str().  I guess capture.output is one way:

capture.output              package:utils              R Documentation

Send Output to a Character String or File

Description:

     Evaluates its arguments with the output being returned as a
     character string or sent to a file.  Related to 'sink' in the same
     way that 'with' is related to 'attach'.

Usage:

     capture.output(..., file = NULL, append = FALSE)

Arguments:

     ...: Expressions to be evaluated.