Skip to content

Commit 60466a8

Browse files
committed
fixed #2
1 parent dcbc8e2 commit 60466a8

File tree

5 files changed

+20
-6
lines changed

5 files changed

+20
-6
lines changed

R/data.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#' It provides insights into the transactions that have occurred, including order dates, delivery dates, customer and store information,
55
#' as well as product details.
66
#'
7-
#' @format A data frame with 12 columns:
7+
#' @format A data frame with 17 columns:
88
#' \describe{
99
#' \item{order_key}{\code{double} Unique identifier for each order.}
1010
#' \item{line_number}{\code{double} Line number within the order (for multi-line orders).}
@@ -19,8 +19,12 @@
1919
#' \item{unit_cost}{\code{double} The cost per unit of the product.}
2020
#' \item{currency_code}{\code{character} The currency code used for the transaction (e.g., USD, EUR).}
2121
#' \item{exchange_rate}{\code{double} The exchange rate applied to the currency, if applicable.}
22+
#' \item{revenue}{\code{double} A product's unit_price multiplied by quantity.}
23+
#' \item{cogs}{\code{double} A product's unit_cost multiplied by quantity.}
24+
#' \item{margin}{\code{double} A product's revenue minus cogs.}
25+
#' \item{unit_margin}{\code{double} A product unit_price minus unit_cost.}
2226
#' }
23-
#' @source Contonso dataset
27+
#' @source https://github.com/sql-bi/Contoso-Data-Generator-V2-Data/releases/tag/ready-to-use-data
2428
"sales"
2529

2630

README.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The package comes with the following datasets:
3434
- Contains detailed line items for each order, including product key, quantity, and price for each item in the order.
3535

3636

37-
You can either load the datasets directly or use the function `create_contoso_duckdb()` to create a DuckDB that contains the following tables:
37+
You can either load the datasets directly or use the function `create_contoso_duckdb()` to create a DuckDB database that contains the following tables:
3838

3939
The Contoso dataset is a fictional set of data created by Microsoft. It is commonly used for educational and demonstration purposes to showcase various features of data analysis, business intelligence tools, and data processing techniques
4040

data-raw/sales.R

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ fpaR::create_data_raw()
55

66
dir <- "data-raw"
77

8-
sales <- readr::read_csv(file.path(dir,"sales.csv"),name_repair = janitor::make_clean_names,show_col_types = FALSE)
8+
sales <- readr::read_csv(file.path(dir,"sales.csv"),name_repair = janitor::make_clean_names,show_col_types = FALSE) |>
9+
dplyr::mutate(
10+
revenue=quantity*unit_price
11+
,cogs=quantity*unit_cost
12+
,margin=revenue-cogs
13+
,unit_margin=unit_price-unit_cost
14+
)
915

1016

1117
usethis::use_data(sales, overwrite = TRUE)

data/sales.rda

68.8 KB
Binary file not shown.

man/sales.Rd

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)