[R] confused with yearmon, xts and maybe zoo

2010-04-18 Thread simeon duckworth
R-listers, I am using xts with a yearmon index, but am getting some inconsistent results with the date index when i drop observations (for example by using na.omit). The issue is illustrated in the example below. If I start with a monthly zooreg series starting in 2009, yearmon converts this to

Re: [R] confused with yearmon, xts and maybe zoo

2010-04-18 Thread simeon duckworth
-18 19:37:26 BST On Sun, Apr 18, 2010 at 1:25 PM, simeon duckworth simeonduckwo...@gmail.com wrote: R-listers, I am using xts with a yearmon index, but am getting some inconsistent results with the date index when i drop observations (for example by using na.omit). The issue is illustrated

Re: [R] confused with yearmon, xts and maybe zoo

2010-04-18 Thread simeon duckworth
... forgot to post this back to the r-list. it seems that the problem is with xts rather than zoo and yearmon per se ie using yearmon to index xts gives inconsistent results. grateful for any help anyone can offer. thanks On Sun, Apr 18, 2010 at 8:15 PM, simeon duckworth simeonduckwo

[R] chron, xts and zoo

2010-01-14 Thread simeon duckworth
dear r folks i am a bit puzzled about how to use chron as an index xts and why it differs from zoo. in this example, why can i index zoo but not xts x-1:23 time.of.day - times(paste(x,:0:0,sep=),format=h:m:s) day - dates(4/8/90) period - chron(dates=day,times=time.of.day) xts(1:23,period)

[R] Plyr and memory allocation issue

2009-08-18 Thread simeon duckworth
Dear R users I am trying to create some new variables for a 4401 x 30 dataframe using ddply and transform. The id variable i am using is a factor with 1330 levles eg bb - function(df) {transform(df, years = study.year - min(study.year) + 1, periods = length(study.year)

[R] Read name multiple excel sheets using RODBC

2009-05-28 Thread simeon duckworth
I'd like to be able to read multiple sheets from an excel workbook and use the sheet name to name the resulting dataframe using RODBC. at the moment i've figured out how to do it the long way (see below) but feel sure that there is a speedier possibly automatic way to do it in R. i've tried to

[R] text matching and substitution

2009-03-28 Thread simeon duckworth
I am trying to simplify a text variable by matching and replacing it with a string in another vector so for example in colours - paste(letters,colours(),stuff,LETTERS) find and replace with (red,blue,green,gray,yellow,other) - irrespective of case its a large dataset, so i'd like to be able to

Re: [R] text matching and substitution

2009-03-28 Thread simeon duckworth
) } On Sat, Mar 28, 2009 at 9:45 AM, Stephan Kolassa stephan.kola...@gmx.dewrote: Hi Simeon, ?gsub HTH, Stephan simeon duckworth schrieb: I am trying to simplify a text variable by matching and replacing it with a string in another vector so for example in colours - paste(letters,colours

Re: [R] text matching and substitution

2009-03-28 Thread simeon duckworth
} Best of luck, Stephan simeon duckworth schrieb: stephan sorry for not being clear - but thats exactly what i want. i'd like to replace every complex string that contains red with just red, and then so on with blue, yellow etc my data is of the form x xx xx

[R] calculating compound growth rates - creating a flexible function

2009-02-22 Thread simeon duckworth
R-listers I am still finding my way with R - and feel that I am making a complete dogs dinner of something that should be pretty simple. What I'd like to do is to create a simple function that i can use to calculate compound growth rates (CAGRs) over a data frame. I'd like the function to be

[R] Downloading Excel file reading a range

2009-01-17 Thread simeon duckworth
I am trying to figure out a way to download an Excel file and then read a range into R - so that i can have a reasonably automated process. I have been trying to use the RODBC package, but with little success. I suspect that this isnt the right route Here is some code. My aim is to read in

[R] ggplot2 ribbon

2008-02-16 Thread simeon duckworth
I would like to be able to shade between two lines using ggplot2 (with faceting too). But, despite reading all the documentation on the website, cant figure out how to do it (either because i am a novice or idiot - or, of course, possibly both) My data looks is readership of paid free