sweinand / pricelevels

Price Level Comparisons
0 stars 0 forks source link

Weights in cpd() #13

Closed sweinand closed 1 year ago

sweinand commented 1 year ago

Include the following code. Otherwise w is not defined if provided and there are duplicates for example (-> lengths will differ).

# compute expenditure share weights for each region:
  if(!is.null(q)){
    pdata[, "w" := (p*z)/sum(p*z, na.rm=TRUE), by="r"]
  }else{
    pdata[, "w" := z]
  }
sweinand commented 1 year ago

Fixed