Speed up folder loading in mutt

January 26, 2007 at 7:28 am | In Linux | Leave a Comment

Sometimes you have these little nuggets tucked away somewhere. Yesterday I found I could add the following line to my .muttrc and now it loads my huge mail folders in a flash!!

set header_cache=/home/<username>/.mutt_cache

It used to be so boring to see mutt loading a folder with over a thousand messages. Now, it takes no time!!

Should be a default for mutt.

V


mutt colours

January 24, 2007 at 7:19 am | In Linux | Leave a Comment

I just spiced up my mutt with colors. Used the basic color schemes from here and then changed it to suit my requirements. Looks cool!!

v.


Renaming variables in a dataframe

January 19, 2007 at 1:11 pm | In Data manipulation, GNU-R | Leave a Comment

There is no direct command in R for renaming variables and that may make it less than obvious for some people. Of course, once you know, it is simple. The following command does the trick.

names(dataframe)[names(dataframe)=="oldvariablename"]<-”newvariablename”

 

VR

 

Technorati:

Area under curve

January 12, 2007 at 7:16 am | In GNU-R | Leave a Comment

There are various ways in which you can get R to calculate area under a curve. Some of these are explained in various posts on this thread. Ravi Varadhan wrote up the following function that uses trapezoidal rule for calculating area between a 45 degrees line and a curve. I used it to get gini coefficients from a lorenz curve.

trap.rule-function(x,f) {sum(diff(x)*(f[-1]+f[-length(f)]))/2}

trap.rule(x,f=y-x)

(Area is negative if y(x) is below the 45 degrees line)

 

Technorati:

Postscript graphics from R

January 12, 2007 at 7:02 am | In GNU-R, Graphics | Leave a Comment

Graphics made in R are best saved as postscript files if the files are to be used for printing. This can be done by wrapping your commands (for example, plot) in a postscript device, or by printing the plot to postscript after the plot has been created.

Method 1.

postscript(“filename”,width=x,height=y)

plot commands

dev.off()

 

Method 2.

Plot commands #these would, by default, display the plot on the screen

dev.copy2eps(file=<filename>,width=x,height=y) #also see ?dev.print

Note that the postscript files created by R do not have a preview attached with them. So that, when you insert them in an MS-word/Openoffice file, you just see a bounding box and not the image itself. Of course, it prints the image all right.

Your friends who are not used to postscript files may be uncomfortable with this. If you want to insert a preview image so that they can see the image on the screen as well, use epstool on the linux command line to add a preview to the postscript file.

 

Technorati:

Use reshape to tabulate

January 7, 2007 at 12:00 pm | In Data manipulation, GNU-R | Leave a Comment

Package reshape is meant for aggregating, reshaping and tabulating data.Tabulation is done in two steps: melt and cast. Read help for these functions.

melt(sl1,id.var=,measure.var=”foo”)->sl2

This will create a dataframe sl2 which will have all the variablesin sl1 and “foo” being reorganised for casting later. See head(sl2) to see the form it takes.

The following command takes the molten dataframe and produces a table.

cast(sl2,formula,fun)

where fun is the aggregating function you want to use. The formula takes the form var1~var2~var3. See help for cast for more details on specification of the formula.

 

Technorati:

List of variables in a dataframe

January 7, 2007 at 10:55 am | In Data manipulation, GNU-R | Leave a Comment

Function “names” gives list of columns/variables in a dataframe.

 

 

 

 

Technorati:

R2HTML package

January 7, 2007 at 10:50 am | In GNU-R | Leave a Comment

We can use R2HTML package to direct output of R to an html file.

Remember, R2HTML package is different from R2html command in the prettyR package.

 

The basic syntaxt of using it in an interactive R session is as follows.

 

library(R2HTML)

HTMLStart(filename = “~/test.html”, echo=TRUE)

..R commands …

HTMLStop()

This works neatly with Emacs and ESS as well.

 

Technorati:

Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.