Re: [R] Converting Variable Name into String

2011-05-19 Thread Paolo Rossi
Hi Bert, thanks for your advice on lapply which I am still not very familair with. With regard from the issue of the names I realised that I can simply call names on the data.frame and then join them with other strings through paste and add them to the data.frame by using the [] syntax rather than

Re: [R] Converting Variable Name into String

2011-05-19 Thread Bert Gunter
1. This won't work. The lagged variables have length one less than the originals. 2. How about: lagged_Q <- data.frame( lapply( QuarterlyData,diff)) You can then change the names in lagged_Q to something like lagged_originalName via paste() if you like. 3. I strongly suspect that none of this i

[R] Converting Variable Name into String

2011-05-19 Thread Paolo Rossi
Hello, I would like to create lagged and delta variables from a set of variables and then add them to a dataframe Suppose that GDPPcSa is a variable. I would like to be able to do this QuarterlyData$D1GdpPcSa = diff(GDPPcSa , 1) in an automated fashion so that I loop over Quartely data to compu