Package {vegetablesSriLanka}


Type: Package
Title: Daily Vegetable Prices of Sri Lanka
Version: 1.1.0
Description: Provides retail and wholesale vegetable price data from two major market hubs in Sri Lanka, Dambulla and Pettah. Includes tools for analyzing, visualizing, and comparing vegetable prices across markets.
Maintainer: Thiyanga S. Talagala <ttalagala@sjp.ac.lk>
License: GPL-3
Encoding: UTF-8
LazyData: true
Depends: R (≥ 4.1.0)
Imports: tsibble, dplyr, naniar, visdat, ggplot2
RoxygenNote: 7.3.3
Suggests: knitr, rmarkdown
NeedsCompilation: no
Packaged: 2026-05-03 08:53:13 UTC; DELL
Author: Thiyanga S. Talagala ORCID iD [aut, cre], Thisuri Jayarathne ORCID iD [aut], Priyanga Dilini Talagala ORCID iD [aut]
Repository: CRAN
Date/Publication: 2026-05-05 19:20:02 UTC

Fill gaps in vegetable price time series

Description

Fill missing gaps with NA. The function filters the dataset based on the selected item, market, and type, converts the data into a tsibble, and generates a regular time series filling the gaps with NA.

Usage

fillgaps_vegetable_prices(data, item, market, type)

Arguments

data

A data frame containing vegetable price data. The dataset must contain the columns Date, Item, Type, Market, and Price.

item

Character string specifying the vegetable item.

market

Character string specifying the market.

type

Character string specifying the price type (e.g., "Retail" or "Wholesale").

Value

A ggplot object showing the time series of vegetable prices.

Examples

fillgaps_vegetable_prices(
  data = vegetables.srilanka,
  item = "Carrot",
  market = "Dambulla",
  type = "Retail"
)


Plot vegetable price time series

Description

Visualize retail or wholesale vegetable prices over time for selected items and markets in Sri Lanka. The function filters the dataset based on the selected item, market, and type, converts the data into a tsibble, and generates a time series plot.

Usage

plot_vegetable_prices(data, item, market, type)

Arguments

data

A data frame containing vegetable price data. The dataset must contain the columns Date, Item, Type, Market, and Price.

item

Character string specifying the vegetable item.

market

Character string specifying the market.

type

Character string specifying the price type (e.g., "Retail" or "Wholesale").

Value

A ggplot object showing the time series of vegetable prices.

Examples

plot_vegetable_prices(
  data = vegetables.srilanka,
  item = "Carrot",
  market = "Dambulla",
  type = "Retail"
)


Daily wholesale and retail vegetable prices in Sri Lanka

Description

Daily wholesale and retail vegetable prices at Dambulla and Petta markets in Sri Lanka

Usage

vegetables.srilanka

Format

A tibble with 62908 rows and 5 variables:

Date

Date

Item

Vegetable name

Type

Wholesale or Retail price

Market

Pettah or Dambulla market

Price

Price in LKR per kg

Source

Accessed from Daily Reports - Central Bank of Sri Lanka

Examples

head(vegetables.srilanka)

Visualize missingness in vegetable price data

Description

Generates a set of visual summaries to inspect data structure and missing values in the dataset. The function returns: (1) data type visualization, (2) missingness map, and (3) missing percentage by grouping variable.

Usage

visualize_missingness(data, group_var = "Item", target_var = "Price")

Arguments

data

A data frame.

group_var

Character string specifying the grouping variable for missing percentage visualization (e.g., "Item").

target_var

Character string specifying the variable to assess missingness (e.g., "Price").

Value

A named list containing:

Examples

visualize_missingness(
  data = vegetables.srilanka,
  group_var = "Item",
  target_var = "Price"
)