addCategories: addCategories

Description Usage Arguments Details Value Examples

View source: R/spendingCategories.R

Description

For each budget category check if in any pattern is a match with the Description. Return the name of the category that matches.

Usage

1
addCategories(Description, myCategories)

Arguments

Description

character vector

myCategories

list; each named element contains a character vector of all known patterns defining that category.

Details

If none of the categories contain a pattern that matches then return MISSING. A Description is not allowed to belong to multiple categories. The first instance of such a problem will cause an error to be thrown with the first Description and all the categories it has been matched with.

Value

character vector

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
  Description <- c('rent 2019 march',
                   'Happy Co. gas 20190601',
                   'New restaurant')
  myCategories <- list(housing = c('rent', 'Hardware Inc'),
                       transportation = 'gas')
  addCategories(Description = Description, myCategories)
## Not run: 
  addCategories(Description = c("gas rent"), myCategories)

## End(Not run)

rkuttner7/homeBudget documentation built on Dec. 19, 2020, 12:47 p.m.