getPotencialGain: Get the potential profit gain.

View source: R/functions.R

getPotencialGainR Documentation

Get the potential profit gain.

Usage

getPotencialGain(obj, from, to)

Arguments

obj
from
to

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (obj, from, to) 
{
    tickets <- as.character(read.csv("objTickets.csv")[[1]])
    newObj <- new.env()
    for (ticket in tickets) {
        print(ticket)
        ds <- obj[[ticket]]
        lfrom <- from
        year <- c()
        gain <- c()
        if (class(ds) == "data.frame") {
            while (as.numeric(lfrom) <= as.numeric(to)) {
                gain <- c(gain, getPotencialYearGain(ds, lfrom))
                year <- c(year, lfrom)
                lfrom <- as.character(as.numeric(lfrom) + 1)
            }
            newObj[[ticket]] <- data.frame(year, gain)
        }
    }
    return(newObj)
  }

danielfhenrique789/profitmaximization documentation built on April 5, 2025, 4:05 p.m.