[R-SIG-Finance] Question on re-indexing data for graphing

Harris Butler c10harris.butler at gmail.com
Thu Jan 31 21:30:46 CET 2013


This probably isn't an appropriate question for R-SIG-Finance, which
from what I've seen is usually for stuff related to financial details
like model fiting and financial/quant packages/functions.  General R
questions like data manipulation and plotting should probably be asked
to the R-help mailing list.

With that said, I'll try to help anyway.  Assuming your data is in a
data frame and has the countries in columns and years in rows, you can
reindex by dividing the whole frame (which I call "df") by the first
row:

df = df / df[1,]

This will reindex everything and have the first row starting at 1.
You can multiply by 100 if you want.  I'm not in front of my
workstation right now, but I'm pretty sure it will work.

-- 
Cheers,

Harris Butler


On 1/31/13, brendan dornan <brendan_dornan at hotmail.com> wrote:
> Hi,
> A file contains data for 1975-2012 of housing prices across a panel of
> countries.
> However, it's indexed to 2005, so each country's housing price series
> converges to 100 in 2005, then they spread apart again to 2012.
> This makes graphing all data series on one chart for comparison's sake
> somewhat awkward and unintelligible.
> Without the original data, a. could one properly reindex the data from 1975
> in a statistically correct manner, and b. how could someone do this in R?
> Posted this in cross-validated, but if there is a better forum for this
> question, just let me know.
> Thanks for any help!



More information about the R-SIG-Finance mailing list