Wednesday, August 10, 2011

Making a progress bar for long R programs

From : http://ryouready.wordpress.com/2009/03/16/r-monitor-function-progress-with-a-progress-bar/

total <- 20
# create progress bar
pb <- txtProgressBar(min = 0, max = total, style = 3)
for(i in 1:total){
Sys.sleep(0.1)
# update progress bar
setTxtProgressBar(pb, i)
}
close(pb)

Tuesday, August 2, 2011

How to concatenate a list of data.frames to obtain a data.frame in R

From http://stackoverflow.com/questions/2851327/r-converting-a-list-of-data-frames-into-one-data-frame :

df <- do.call("rbind", listOfDataFrames)

Monday, August 1, 2011

extract maps in sp format from the maps package in R

from the doc of the package spacetime :

library(maps)
states.m = map('state', plot=FALSE, fill=TRUE)
IDs <- sapply(strsplit(states.m$names, ":"), function(x) x[1])
library(maptools)
states = map2SpatialPolygons(states.m, IDs=IDs)
class(states)
[1] "SpatialPolygons"
attr(,"package")
[1] "sp"

Monday, July 25, 2011

reading numeric data from a string variable in R

use textConnection :

strin_var = readLines(textfle)
tc=textConnection(string_var)
df = read.table(tc,colClasses="numeric")


http://www.r-bloggers.com/example-8-27-using-regular-expressions-to-read-data-with-variable-number-of-words-in-a-field/

Friday, July 15, 2011

Backing up or moving a Silverstripe website

http://silverstripe.org/installing-silverstripe/show/4581#post251271

Thursday, July 14, 2011

Flushing cache in Silverstripe

go to the link http://silverstripe.website.org/?flush=1

Wednesday, July 13, 2011