[R] Parsing unusual date format

2008-12-17 Thread Shruthi Jayaram
Hello, If I have a character string like d <- c("1990m3", "1992m8") #March 1990 and Aug 1992 what is the easiest way to convert it into any standard date form; for example, d <- c("01/03/1990", "01/08/1992") I looked at as.Date but it doesn't seem to address my problem as I have an "m" stuck

[R] For and if confusion

2008-12-18 Thread Shruthi Jayaram
I have two date objects X <- c("01-03-1993", "01-05-1997") #Mar 1993 and May 1997 Y <- c("01-02-1995", "01-08-1999") #Feb 1995 and Aug 1999 and a time series object A <- ts(rnorm(120), freq=12, start=c(1992,8)) #Aug 1992 to Aug 2002 I want to create a binary (0-1) vector B that is of length 1

Re: [R] Parsing unusual date format

2008-12-18 Thread Shruthi Jayaram
Thanks so much everyone, these suggestions solve my problem in a very elegant way. A friend and I also came up with this "brute force" solution: T <- c("1993m10") y <- gsub("m.", "", T) m <- gsub(".*m", "", T) d <- paste(y,"-0",m,"-","01", sep="") T <- as.Date(d, format="%Y-%m-%d") Thought I w

[R] calling SCILAB from R

2008-12-30 Thread Shruthi Jayaram
Hi, am not sure if this is the best platform to ask this question, so please excuse it if it's tangential. I am writing an R function that also involves some brief interfacing with SCILAB. I am doing this via the terminal in LINUX, using the system() command. I have an .sce file that I wish to exe

[R] if statement

2009-01-05 Thread Shruthi Jayaram
Hi, How do I check for two conditions in an if loop? I want to check if a value lies between 2 other values. For example, A <- ts(rnorm(120), freq=12, start=c(1992,8)) X <- 0.5 Y <- 0.8 I would like to create a new vector C for which C[i] is 0 if A[i] lies in between X and Y. Would be grate

[R] Convert to as.Date

2009-01-08 Thread Shruthi Jayaram
Hi, I have an vector object that looks like DA <- c("1991q1", "1993q2") (first quarter of 1991 etc) and I want to convert it into a date object using as.Date(). I did this for montly data but am stumped when it comes to dealing with quarterly data and as.Date. Would anyone be able to help?

[R] Confidence intervals in ccf()

2009-01-20 Thread Shruthi Jayaram
Hi, I have been running the ccf() function to find cross-correlations of time series across various lags. When I give the option of plot=TRUE, I get a plot that gives me 95% confidence interval cut-offs (based on sample covariances) for my cross-correlations at each lag. This gives me a sense of

[R] Matrix

2009-02-02 Thread Shruthi Jayaram
Hi, I have a very basic question on merging two matrices by alternating the rows. For illustration, assume two matrices - A looks like: 10 10 10 10 B looks like: 20 20 20 20 How do I combine them such that I get alternating rows from A and B? My final result should be C which looks like: 1

[R] Beveridge Nelson Decomposition

2009-02-02 Thread Shruthi Jayaram
Hi, Would anyone know if it is possible to run a Beveridge Nelson decomposition of a univariate time series object in R? I searched in the help files but didn't come across any potential methods. Thanks very much, Shruthi -- View this message in context: http://www.nabble.com/Beveridge-Nelso

Re: [R] Matrix

2009-02-02 Thread Shruthi Jayaram
Grothendieck > wrote: > > Try this: > > > > matrix(rbind(x, y), nc = 2, byrow = TRUE) > > > > > > On Mon, Feb 2, 2009 at 10:52 AM, Shruthi Jayaram > > wrote: > >> > >> Hi, > >> > >> I have a very basic question on me

[R] Using getSymbols

2009-02-02 Thread Shruthi Jayaram
Hi, How can one ask getSymbols to obtain data within a specified time interval? For example, if I am downloading US PPI data: usppi <- as.zoo(getSymbols("PPIACO", src="FRED", verbose=TRUE, auto.assign=FALSE)) How do I ask getSymbols to truncate starting from Jan-1970 until present? I looked up

[R] HAC corrected standard errors

2009-03-10 Thread Shruthi Jayaram
Hi, I have a simple linear regression for which I want to obtain HAC corrected standard errors, since I have significant serial/auto correlation in my residuals, and also potential heteroskedasticity. Would anyone be able to direct me to the function that implements this in R? It's a basic quest