Dear list

I have a large data frame with house prices. Prices have been converted 
to price per m2, to be able to compare. Prices are spread over almost 10 
years, each price is tagged with the year it relates to.

I would like to 'normalize' all the prices to, eg. 2010 prices.

The data frame looks like this

 > head(dafP)

Y P

1 2004 11199.60

2 2005 15310.10

3 2005 19491.50

4 2005 18656.70

5 2005 16092.00

6 2005 9929.08

Y is Year and P is price (in Danish Kroner) per m2

I looked in some old scripts and have written this:

dafP$Yav <- ave(dafP$P,dafP$Y,FUN=mean) # Yav. Prices Weight per Year, 
i.e. Yearly mean

dafP$Pno <- dafP$P * (mean(dafP$P)/dafP$Yav) # Prize Normalized by Year

Can any one comment on this:

    *

      This code only normalizes so all year get the same mean. How would
      I go about 'normalizing' to a specific year, eg. 2010?

Best Regards

Martin


-- 
*/ Martin Hvidberg
    Tanggårdsvej 22
    2680 Solrød
    tlf.: 35 83 01 91
    email: mar...@hvidberg.net /*


        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to