Skip to content
Prev 11255 / 15274 Next

Question on re-indexing data for graphing

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.