[R-pkg-devel] Roxygen help documenting a S4 class
Glenn Schultz
glennmschultz at me.com
Sat Apr 23 01:54:17 CEST 2016
Hi Hadley,
Thank-you for taking the time to help - Ha! nice trick - thanks! Much better than staring at lines trying to figure out what went wrong. First time I had seen that warning too. Now, I know what it means.
Thanks,
Glenn
> On Apr 22, 2016, at 5:47 PM, Hadley Wickham <h.wickham at gmail.com> wrote:
>
> Does this help?
>
> code <- c("BeginningBal", "Convexity", "EffConvexity", "EffDuration",
> "EndingBal",
> "Formula", "Horizon", "HorizonReturn", "KeyRateConvexity", "KeyRateDuration",
> "KeyRateTenor", "ModDuration", "Name", "PassThroughInterest", "Period",
> "PmtDate", "PrepaidPrin", "SMM", "ScheduledPrin", "ShiftType", "Shiftbps",
> "SpreadToInterCurve", "TimePeriod", "TotalCashFlow", "Type", "WAL",
> "YieldToMaturity", "forwardrate", "spotrate")
>
> docs <- c("BeginningBal", "Convexity", "EffDuration", "EndingBal",
> "Formula", "Horizon",
> "KeyConvexity", "KeyRateDuration", "KeyRateTenor", "ModDuration", "Name",
> "PassThroughInterest", "Period", "PmtDate", "PrepaidPrin", "SMM",
> "ScheduledPrin", "ShiftType", "Shiftbps", "SpreadToInterCurve", "TimePeriod",
> "TotalCashFlow", "Type", "WAL", "YieldToMaturity", "forwardrate", "spotrate" )
>
>
> setdiff(code, docs)
> setdiff(docs, code)
>
> Hadley
>
> On Fri, Apr 22, 2016 at 10:31 AM, Glenn Schultz <glennmschultz at me.com> wrote:
>> All,
>>
>> Below are two classes that I have created Scenario and Mtg.Scenario.
>>
>> Mtg.Scenario contains Scenario when I run check I get the following warning.
>>
>> I have gone through my book R Packages and looked at the EPub writing extension but I cannot find an example.
>>
>> Any help is appreciated
>> Glenn
>>
>> * checking for code/documentation mismatches ... WARNING
>> S4 class codoc mismatches from documentation object 'Mtg.Scenario-class':
>> Slots for class 'Mtg.Scenario'
>> Code: BeginningBal Convexity EffConvexity EffDuration EndingBal
>> Formula Horizon HorizonReturn KeyRateConvexity KeyRateDuration
>> KeyRateTenor ModDuration Name PassThroughInterest Period
>> PmtDate PrepaidPrin SMM ScheduledPrin ShiftType Shiftbps
>> SpreadToInterCurve TimePeriod TotalCashFlow Type WAL
>> YieldToMaturity forwardrate spotrate
>> Inherited: Name Type Horizon ShiftType Shiftbps Formula
>> Docs: BeginningBal Convexity EffDuration EndingBal Formula Horizon
>> KeyConvexity KeyRateDuration KeyRateTenor ModDuration Name
>> PassThroughInterest Period PmtDate PrepaidPrin SMM
>> ScheduledPrin ShiftType Shiftbps SpreadToInterCurve TimePeriod
>> TotalCashFlow Type WAL YieldToMaturity forwardrate spotrate
>>
>>
>>
>> #' An S4 Class representing scenario analysis details
>> #'
>> #' The class Scenario is the representation of the
>> #' scenario run by the investor
>> #' @slot Name A character the name of the scenario
>> #' @slot Type A character the type of the scenario
>> #' @slot Horizon A character the time horizon over which the
>> #' scenario is run
>> #' @slot ShiftType A character the interest rate shift type (e.g.
>> #' twist, parallel, bull flatten, or bull steepen)
>> #' @slot Shiftbps A numeric value the scenario shift in basis points
>> #' @slot Formula A function represnting the shift which applied to the term structure
>> #' @exportClass Scenario
>> setClass("Scenario",
>> representation(
>> Name = "character",
>> Type = "character",
>> Horizon = "character",
>> ShiftType = "character",
>> Shiftbps = "numeric",
>> Formula = "function"
>> ))
>>
>> #' An S4 Class representing the results of mortgage return scenario analysis
>> #'
>> #' The class Mtg. Scenario holds the results of a scenario analysis run
>> #' @slot Period A numeric value the period number forward from current
>> #' @slot PmtDate A character the payment date on which the cashflow is expected to be received
>> #' @slot TimePeriod A numeric value the period stated as a unit of time
>> #' @slot BeginningBal A numeric value the forecasted beginning balance in the period
>> #' @slot PassThroughInterest A numeric value the interest paid through to the investor
>> #' @slot ScheduledPrin A numeric value the scheduled principal due in the period
>> #' @slot PrepaidPrin A numeric value the forecasted prepaid principal in the period
>> #' @slot EndingBal A numeric value the forecasted ending balance in the period
>> #' @slot TotalCashFlow A numeric value the forecasted total cashflow received by
>> #' the investor in the period
>> #' @slot spotrate A numeric vector the spot rate curve
>> #' @slot forwardrate A numeric vector the forward rate curve
>> #' @slot SMM A numeric vector the forecasted SMM vector
>> #' @slot YieldToMaturity A numeric value the scenario yield to maturity
>> #' @slot WAL A numeric value the scenario weighted average life
>> #' @slot SpreadToInterCurve A numeric value the spread to the interpolated curve
>> #' @slot ModDuration A numeric value the scenario modified duration
>> #' @slot Convexity A numeric value the scenario convexity
>> #' @slot EffDuration A numeric value the effective duration which is the sum of the
>> #' key rate durations
>> #' @slot KeyRateTenor A numeric vector the key rate tenors
>> #' @slot KeyRateDuration A numeric vector the duration of each key rate tenor
>> #' @slot KeyConvexity A numeric vector the convexity of each each key rate tenor
>> #' @exportClass Mtg.Scenario
>> setClass("Mtg.Scenario",
>> representation(
>> Period = "numeric",
>> PmtDate = "character",
>> TimePeriod = "numeric",
>> BeginningBal = "numeric",
>> PassThroughInterest = "numeric",
>> ScheduledPrin = "numeric",
>> PrepaidPrin = "numeric",
>> EndingBal = "numeric",
>> TotalCashFlow = "numeric",
>> spotrate = "numeric",
>> forwardrate = "numeric",
>> SMM = "numeric",
>> YieldToMaturity = "numeric",
>> WAL = "numeric",
>> SpreadToInterCurve = "numeric",
>> ModDuration = "numeric",
>> Convexity = "numeric",
>> EffDuration = "numeric",
>> EffConvexity = "numeric",
>> KeyRateTenor = "numeric",
>> KeyRateDuration = "numeric",
>> KeyRateConvexity = "numeric",
>> HorizonReturn = "numeric"),
>> contains = "Scenario")
>>
>> ______________________________________________
>> R-package-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>
>
>
> --
> http://hadley.nz
More information about the R-package-devel
mailing list