Archive For November 7, 2014

push and pop your way around the shell

By |

On the bash shell, it’s helpful for me have a list of directories at my disposal. That way I can easily jump from one directory to another without having to type it all in. Even with tab completion, that’s a pain. Hence pushd. pushd is not well documented, but basically you can push onto a…

Read more »

1L

By |

Just learned this and will forget it immediately. In R, the ‘L’ suffix explicitly makes the preceding number an integer. So 1L is the integer 1, whereas 1 is numeric whose value is equal to 1. The helps when you want to save some memory costs such as in a loop over say 1:100L Compare…

Read more »

Using colClasses to speed up file reading

By |

This is a nice tip I picked up from Bioconductor course: tab5rows = read.table(“data.txt”, header=TRUE, nrows=5) classes = sapply(tab5rows, class) tabAll = read.table(“datatable.txt”, header=TRUE, colClasses=classes) Basically, read in a few lines and determine the class type of each column. Then pass that information to read.table through the param colClasses. The important thing here is to…

Read more »