Tuesday, July 31, 2012

Changing system locale in R for locale dependent time string readings

lct <- Sys.getlocale("LC_TIME")
lct
[1] "French_Canada.1252"
strptime(" 27 Jun 2011 19:57:18","%d %b %Y %H:%M:%S") #Does not work
[1] NA
Sys.setlocale("LC_TIME", "C") #Change the locale to C
[1] "C"
strptime(" 27 Jun 2011 19:57:18","%d %b %Y %H:%M:%S") #Now it works
[1] "2011-06-27 19:57:18"
Sys.setlocale("LC_TIME", lct)
[1] "French_Canada.1252"

Sunday, July 29, 2012

Debugging R : Catching warnings

withCallingHandlers(HL<-IDP_Read_Hydrolight512_Mfile(infile), warning=function(c) recover())

Accessing the contents of the special argument "..." in R

names(match.call())

also try ..1, ..2 etc

also try
dots <-match .call=".call" expand.dots="F)$...<!-----">

Friday, July 27, 2012

Multiple Y-axis in a R plot

Good and simple tutorial : http://www.r-bloggers.com/multiple-y-axis-in-a-r-plot/

Thursday, July 5, 2012

R graphic margins

R graphic margins http://rgraphics.limnology.wisc.edu/rmargins_sf.php http://research.stowers-institute.org/efg/R/Graphics/Basics/mar-oma/index.htm