Description Usage Arguments Value Examples
View source: R/create_shares.R
Create Market Shares from Quantity Sold
1 | mkt_share_from_sales(df, quantity, population, frac_pop = 1)
|
df |
Dataframe to work with |
quantity |
Variable containing number of goods sold, as a character string. |
population |
Variable containing number of number of individuals in the market, as a string. |
frac_pop |
Fraction of population to use when obtaining market shares, between 0 and 1. |
A dataframe with the variable mkt_share
added as a column.
1 2 3 4 5 6 7 8 9 | # Relevant market is entire population
new_df <- mkt_share_from_sales(eurocars,
quantity = 'qty_sold',
population = 'population')
# Relevant market is 1/2 the entire population
new_df <- mkt_share_from_sales(eurocars,
quantity = 'qty_sold',
population = 'population',
frac_pop = 0.5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.