pq_index
creates a sector/industry index using the method of weighted geometric mean, based on a set of data and corresponding weights.
pq_index(dt, x = "close|value", w = "cap_total", base_value = 1, base_date = NULL, name = NULL)
dt | a list/dataframe of time series dataset |
---|---|
x | the name of column to create index. Default is 'close|value' |
w | the name of weights column. Default is 'cap_total'. If x is not available or is NULL, then using equal weights. |
base_value | the base value of index. Default is 1. |
base_date | the base date of index. Default is the minimum date. |
name | the name of index. Default is NULL, then using 'index'. |
# \donttest{ # Example I bank share index library(data.table) data(banks) # creating index bank_index = pq_index(banks, x='close', w='cap_total') # pq_plot(bank_index) # }