Blog Archives

Extract objects from a list

September 5, 2007
By

When using Rmpi to send processes to many nodes, it is convenient to create a list of tasks that are assigned to nodes as they become available. In my case, I was working through a large factorial set of simulations and needed to use a unique set of va...

Read more »

Extract objects from a list

September 5, 2007
By

When using Rmpi to send processes to many nodes, it is convenient to create a list of tasks that are assigned to nodes as they become available. In my case, I was working through a large factorial set of simulations and needed to use a unique set of va...

Read more »

Execute system commands within an R Script

August 23, 2007
By

To execute a system command from within an R script, just use system(). This is handy for zipping large output files on the fly.write.csv(mydat, "mydat.csv")system("gzip mydat.csv", wait=FALSE)

Read more »

Execute system commands within an R Script

August 23, 2007
By

To execute a system command from within an R script, just use system(). This is handy for zipping large output files on the fly.write.csv(mydat, "mydat.csv")system("gzip mydat.csv", wait=FALSE)

Read more »

Offset in glm ()

August 17, 2007
By

To add an offset to the linear predictor of a generalized linear model (or models from the survival package such as coxph and clogit), use offset(x) in the formula. This will add an offset to the linear predictor with known coefficient 1.

Read more »

Offset in glm ()

August 17, 2007
By

To add an offset to the linear predictor of a generalized linear model (or models from the survival package such as coxph and clogit), use offset(x) in the formula. This will add an offset to the linear predictor with known coefficient 1.

Read more »

Including arguments in R CMD BATCH mode

August 16, 2007
By

When you have multiple computers or processors at your disposal and wish to run the same script with different arguments, use the following at the command line (here described for Linux; remove the linebreak, it is just there for display purposes):$ R CMD BATCH --no-save --no-restore '--args a=1 b=c(2,5,6)'test.R test.out &Where test.R is the R script file you wish...

Read more »

Including arguments in R CMD BATCH mode

August 16, 2007
By

When you have multiple computers or processors at your disposal and wish to run the same script with different arguments, use the following at the command line (here described for Linux; remove the linebreak, it is just there for display purposes):$ R CMD BATCH --no-save --no-restore '--args a=1 b=c(2,5,6)'test.R test.out & Where test.R is the R script file you wish...

Read more »

Variance-Covariance Matrix in glm

July 20, 2007
By

This is a small function Venables and Ripley provide in their MASS book. You don't need it anymore because vcov() has a method for the glm class. However, it is useful to see how to extract bits from a fitted model object.vcov.glm #return the variance-covariance matrix of a glm object #from p. 188 in Venables and Ripley....

Read more »

Variance-Covariance Matrix in glm

July 20, 2007
By

This is a small function Venables and Ripley provide in their MASS book. You don't need it anymore because vcov() has a method for the glm class. However, it is useful to see how to extract bits from a fitted model object.vcov.glm #return the variance-covariance matrix of a glm object #from p. 188 in Venables and Ripley....

Read more »