[R-pkg-devel] need some help to understand package build workflow
Duncan Murdoch
murdoch.duncan at gmail.com
Fri Jul 31 03:38:31 CEST 2015
On 30/07/2015 9:14 PM, Duncan Murdoch wrote:
> On 30/07/2015 8:49 PM, Glenn Schultz wrote:
>> Hi All,
>>
>> I have a package stable and working. Now, I am trying to consolidate some functions that share similar inputs. Example below. So, I branched on github and work with the branch but now when I run the R check in studio I get the following warning:
>>
>> * checking Rd \usage sections ... WARNING
>> Documented arguments not in \usage in documentation object 'Effective.Measure':
>> ‘type’
>>
>> Clearly type is documented. Perhaps this is an R studio/git hub issue. Travis tells me the build is broken. I am trying to build and work with the package within standards so I am not sure what happened. Maybe this is not a topic that belongs here but I can't find answers on the internet.
>
> No, it's not clear that type is documented. You're only showing us the
> .R file, not the .Rd file that Roxygen (?) produced from it.
Discussion went private for a few emails, so to finish this thread here:
Turns out roxygen2 was generating a bad .Rd file, so this is a roxygen2 bug.
Duncan Murdoch
>
> Duncan Murdoch
>
>> Glenn
>>
>> #' A function to compute effective duration and convexity
>> #'
>> #' Calculates the effective duration and based on discount vector (zero coupon)
>> #' cashflow vector, and rate delta
>> #' @param Rate.Delta A numeric value the interest rate shift in basis points
>> #' @param cashflow A numeric vector of cashflow
>> #' @param discount.rates A numeric vector of the discount rates
>> #' @param time.period A numeric vector of the time period
>> #' @param type A character vector to specify either duration or convexity
>> #' @export
>> Effective.Measure <- function(Rate.Delta = numeric(),
>> cashflow = vector(),
>> discount.rates = vector(),
>> time.period = vector(),
>> type = "character"){
>>
>> discount.rates.up = discount.rates + Rate.Delta
>> discount.rates.dwn = discount.rates - Rate.Delta
>> Price.NC = sum((1/((1+discount.rates)^time.period)) * cashflow)
>> Price.UP = sum((1/((1+discount.rates.up)^time.period)) * cashflow)
>> Price.DWN = sum((1/((1+discount.rates.dwn)^time.period)) * cashflow)
>>
>> switch(type,
>> duration = (Price.UP - Price.DWN)/(2*Price.NC*Rate.Delta),
>> convexity = (Price.UP + Price.DWN - (2*Price.NC))/(2*Price.NC*(Rate.Delta^2)))
>>
>> }
>>
>> setGeneric("Effective.Measure", function(Rate.Delta = numeric(),
>> cashflow = vector(),
>> discount.rates = vector(),
>> time.period = vector())
>> {standardGeneric("Effective.Measure")})
>>
>>
>> ______________________________________________
>> R-package-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>
>
More information about the R-package-devel
mailing list