[R] Converting Variable Name into String

From: Paolo Rossi <statmailinglists_at_googlemail.com>
Date: Thu, 19 May 2011 16:05:14 +0100


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 compute the first difference of its variables and add them to the dataframe.

.It would be great to get a way to create the string "D1GdpPcSa" knowing that the name of the var is GdpPcSa. Then I can add the varibale D1GdpPcSa to the dataframe and work on its names attribute.



        [[alternative HTML version deleted]]

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 19 May 2011 - 15:07:28 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 19 May 2011 - 16:20:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive