[R-pkg-devel] run a function from a list

2017-05-27 Thread Glenn Schultz
All, I have a function to split a fixed rate bond into a floater/inverse floater combination (something typically done in mortgage securtizations).  The function returns a list which serves as the deal structure over which principal payment rules will iterate.  However, I would like to call the

[R-pkg-devel] tryCatch defensive programming guidance

2017-02-25 Thread Glenn Schultz
All, I have the following to create a class PriceTypes.  I use try catch on the function and it gives me the error price <- tryCatch(PriceTypes(price = "100") ,error = function(e) print(e) ,warning = function(w) print(w)) I read the section on tryCatch and withCallingHandlers as well the

[R-pkg-devel] TryCatch messages

2017-02-03 Thread Glenn Schultz
All, I have my tryCatch working on my function and rather than crashing I get the error message below.  However, I would just like price must be entered as a character without the information to the right of the : Can this information be suppressed? Thanks, Glenn

[R-pkg-devel] Initialize Method

2017-01-08 Thread Glenn Schultz
All, My package is S4 an I would like to strongly type the input to the constructor function.  I understand from reading help etc that the call to new should be in a function and the method initialize is only used when one would like to customize the call to new or when the inputs are differen

Re: [R-pkg-devel] Including Rcpp in an existing package

2016-12-22 Thread Glenn Schultz
/2016 1:55 PM, Glenn Schultz wrote: | > All, | > My package was not initially built with the rcpp use in mind. I have to include C++ source code for a particular project so I will have edit the description file add src files, etc. by hand. I an going over the rcpp documentation now and rev

[R-pkg-devel] Including Rcpp in an existing package

2016-12-22 Thread Glenn Schultz
All, My package was not initially built with the rcpp use in mind.  I have to include C++ source code for a particular project so I will have edit the description file add src files, etc.  by hand.  I an going over the rcpp documentation now and reviewing the R documentation on extensions as we

[R-pkg-devel] unpacking into a folder

2016-10-30 Thread Glenn Schultz
All, My package has 5 directories which serve as data folders.  I created source scripts for MBS pass-throughs and UST bonds in the BondData folder rather than create and store the objects as this makes it easier to add more bonds to the example data set.  I have a function called BondLabSet()

Re: [R-pkg-devel] environment scoping

2016-10-27 Thread Glenn Schultz
> > This blog post by Jeff Allen is a nice write-up of what you're trying to do: > > http://trestletech.com/2013/04/package-wide-variablescache-in-r-package/ > <http://trestletech.com/2013/04/package-wide-variablescache-in-r-package/> > > -- Jenny > > > O

[R-pkg-devel] environment scoping

2016-10-27 Thread Glenn Schultz
All, I would like to have some inputs available to many functions.  For example, I have coefficient for a term structure fit which I would like to make a available to total return functions.  Thereby eliminating the need to fit the same term structure over and over again.  However, I still rea

[R-pkg-devel] using optimx in a package

2016-10-16 Thread Glenn Schultz
All, I am using optimx in my package to fit the term structure of interest rates.   When I call the function from the package I get the following error: Error in optimx.check(par, optcfg$ufn, optcfg$ugr, optcfg$uhess, lower, : Cannot evaluate function at initial parameters Called from: optimx.c

[R-pkg-devel] Reference Classes

2016-08-21 Thread Glenn Schultz
All, My package BondLab is written in S4.  I need to build recursive tree to create human readable mortgage payment waterfalls in Bond Lab.  I am simply asking if the below idea is doable The current waterfall implementation is a list of lists in a dataframe and payment rules are iterated ove

[R-pkg-devel] create methods in package

2016-07-31 Thread Glenn Schultz
All, I have set-up both getters and setters for my package and everything works great (just like BioConductor). Now, I would like to create new methods that create graphs of cashflows and distributions of OAS simulations. My question is this. Should the method call the constructor function an

Re: [R-pkg-devel] package build warning

2016-07-25 Thread Glenn Schultz
your function in its own file as a test. Is other expected Rd > documentation missing? As a last resort, I have had to set debug break points > in roxygen2 functions, so I can see where it is failing. > > On Sunday, July 24, 2016, Glenn Schultz <mailto:glennmschu...@me.com>>

Re: [R-pkg-devel] package build warning

2016-07-24 Thread Glenn Schultz
ageEffectiveMeasures-class.Rd', with the > expected documentation? > > Everything looks fine for me with your example code in a dummy > package, so if you're still seeing an issue you're going to need to > share your package sources or an otherwise reproducib

Re: [R-pkg-devel] package build warning

2016-07-24 Thread Glenn Schultz
use > `@export` and roxygen2 will do the right thing, depending on what > object you are trying to export. > > On Sun, Jul 24, 2016 at 10:35 AM, Glenn Schultz wrote: >> All, >> >> I get the following warning using Roxygen2 >> >> * checking f

[R-pkg-devel] package build warning

2016-07-24 Thread Glenn Schultz
All, I get the following warning using Roxygen2 * checking for missing documentation entries ... WARNING Undocumented S4 classes: ‘MortgageEffectiveMeasures’ The code to create and document the class is below #' An S4 class MortgageEffectiveMeasures #' #' A class of mortgage effective

[R-pkg-devel] Which is correct ImportFrom or ImportMethodsFrom

2016-05-24 Thread Glenn Schultz
All, My question is ImportMethodsFrom package foo -or- ImportFrom package foo Which is correct? I have a package BondLab. I am creating new package which uses BondLab classes, generics, and methods. The new package extends S4 classes to a S4 new class. The getters are created per BioCondu

[R-pkg-devel] Object getter, Am I doing this right?

2016-05-12 Thread Glenn Schultz
All, I am creating getters and setters for my package which uses S4. To research getters and setters, I have been looking at the bio conductor website and documentation provided therein. I came up with the below as a getter for the object PassThrough. This works PrepaidPrin(PassThrough).

Re: [R-pkg-devel] Roxygen help documenting a S4 class

2016-04-22 Thread Glenn Schultz
l", > "Formula", "Horizon", > "KeyConvexity", "KeyRateDuration", "KeyRateTenor", "ModDuration", "Name", > "PassThroughInterest", "Period", "PmtDate", "PrepaidPrin", "SMM"

[R-pkg-devel] Roxygen help documenting a S4 class

2016-04-22 Thread Glenn Schultz
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 *

Re: [R-pkg-devel] set generic and methods when slot is a function

2016-03-28 Thread Glenn Schultz
; (unrelated: One experience from Bioconductor, is that it is good to have > explicit constructors for S4 objects instead of using new("...").) > > Best, > Kasper > > On Mon, Mar 28, 2016 at 2:09 PM, Glenn Schultz <mailto:glennmschu...@me.com>> wrote: >

[R-pkg-devel] set generic and methods when slot is a function

2016-03-28 Thread Glenn Schultz
All, I am creating a mortgage prepayment model package. The idea is to create a class FRMModelFunction and each slot in the class is a function that may be use in the prepayment. So I would like to create a generic and method that will allow me to call the slot by name. However, I think that I

Re: [R-pkg-devel] Creating Accessor Methods

2016-03-10 Thread Glenn Schultz
anced R' and > 'R packages', both freely available online. > > This is the relevant section of the first book : > http://adv-r.had.co.nz/OO-essentials.html > <http://adv-r.had.co.nz/OO-essentials.html> > This is the other book : http://r-pkgs.had.co.nz/ <htt

[R-pkg-devel] Creating Accessor Methods

2016-03-10 Thread Glenn Schultz
All, I have a package with to S4 classes (MBSCashFlow, REMICCashFlow and BondCashFlow) all of which contain the slot Duration. I would like have an accessor Duration that would work on multiple signatures. Is this possible? I have checked my books, help, BioConductor tutorials and it appears

[R-pkg-devel] Namespace error

2016-02-16 Thread Glenn Schultz
All I am not sure why I am getting this error and I cannot find anything on the net other than try to restart R. I am using Roxygen2 and it clearly says don't edit by hand at the top of the namespace so I am stuck as what to do or look for. Glenn Error in namespaceExport(ns, exports) : undefi

Re: [R-pkg-devel] RCMD Note - why did I have to do this?

2015-12-20 Thread Glenn Schultz
Dec 20, 2015, at 01:37 PM, Hadley Wickham wrote: You didn't include the NOTE you saw, and this isn't valid roxygen: #' @imports methods::fields So it's a bit hard to tell what the problem is. Hadley On Sun, Dec 20, 2015 at 12:02 PM, Glenn Schultz wrote: Hello all, I ne

[R-pkg-devel] RCMD Note - why did I have to do this?

2015-12-20 Thread Glenn Schultz
Hello all, I need some help understanding namespace and methods. I received a note from RCMD imports methods fields... I changed my file from #' @import methods NULL  to include the following: #' @imports methods::fields NULL such that it now reads #' @import methods NULL #' @imports method

[R-pkg-devel] Strange warnings from build

2015-11-27 Thread Glenn Schultz
Hello All,  When I build my package.  I get the following warnings.  I think these are related to LaTex and ElCapitan but are flowing through to my R build. All the tests pass and the help files work.  These are just warnings but are frustrating nonetheless. Note: I just up graded to El Capit

[R-pkg-devel] Class with functions as slots

2015-11-18 Thread Glenn Schultz
All, I have the following class with slots as functions. For the analysis of MBS this is good set-up as it allows for a very clean and modular way of handling things.  My question is really geared to understanding what is happening in R. Below is the function without sato = NULL R CMD throws a

Re: [R-pkg-devel] Problem with Description File

2015-09-01 Thread Glenn Schultz
I solved the problem. By copying the description file from the R library into the project directory. Then everything started working Glenn Sent from my iPhone > On Aug 30, 2015, at 1:55 AM, Uwe Ligges > wrote: > > > >> On 30.08.2015 00:37, Glenn Schultz wrote: &

[R-pkg-devel] Problem with Description File

2015-08-29 Thread Glenn Schultz
Hi All, I am getting an error that the build directory does not contain a description file.  But there is one in the directory.  Everything was working fine until this error.  Any ideas how to fix it? ERROR: The build directory does not contain a DESCRIPTION file so cannot be built as a packag

[R-pkg-devel] Writing vignette and help files

2015-08-19 Thread Glenn Schultz
Hello All, The package that I am working no longer gives warnings upon closing connections and syntax is used properly (and understood - thanks to all that answered my questions).  I have two questions regarding package documentation. Any special considerations when creating multiple vignettes

Re: [R-pkg-devel] Working with connections - What is correct?

2015-08-10 Thread Glenn Schultz
Eddelbuettel wrote: On 11 August 2015 at 02:09, Glenn Schultz wrote: | All, | Is my function just plain wrong or is it just programming style?  I use connections because SODA (software for data analysis) recommends using connections when working with serialized files.   Nothing wrong with connections

Re: [R-pkg-devel] Working with connections - What is correct?

2015-08-10 Thread Glenn Schultz
t is considered "best practice"? -Glenn On Aug 09, 2015, at 09:04 AM, Joshua Ulrich wrote: On Sun, Aug 9, 2015 at 8:59 AM, Glenn Schultz wrote: Hi All, I use connections to open and close data folders needed by my package. After each function closes I get the following warnings (depe

Re: [R-pkg-devel] Working with connections

2015-08-09 Thread Glenn Schultz
anism? Hadley On Sun, Aug 9, 2015 at 7:04 AM, Joshua Ulrich wrote: On Sun, Aug 9, 2015 at 8:59 AM, Glenn Schultz wrote: Hi All, I use connections to open and close data folders needed by my package. After each function closes I get the following warnings (depending on the connection that has been o

Re: [R-pkg-devel] Working with connections

2015-08-09 Thread Glenn Schultz
Hi Joshua, Thank-you. I did not realize that the call to return closed the connection -Glenn > On Aug 9, 2015, at 9:04 AM, Joshua Ulrich wrote: > > On Sun, Aug 9, 2015 at 8:59 AM, Glenn Schultz wrote: >> Hi All, >> >> I use connections to open and close data f

[R-pkg-devel] Working with connections

2015-08-09 Thread Glenn Schultz
Hi All,  I use connections to open and close data folders needed by my package.  After each function closes I get the following warnings (depending on the connection that has been opened). 10: closing unused connection 3 (/Library/Frameworks/R.framework/Versions/3.2/Resources/library/BondLab/

Re: [R-pkg-devel] .tar vs. binary builds

2015-08-04 Thread Glenn Schultz
be addressed. I am researching those. Glenn Sent from my iPhone > On Aug 3, 2015, at 5:10 PM, Duncan Murdoch wrote: > >> On 03/08/2015 4:31 PM, Glenn Schultz wrote: >> Hello All, >> >> I have a package which I would like to distribute. However, there are

Re: [R-pkg-devel] .tar vs. binary builds

2015-08-03 Thread Glenn Schultz
Got it thanks - I want to achieve maximum exposure and transparency Sent from my iPhone > On Aug 3, 2015, at 5:10 PM, Duncan Murdoch wrote: > >> On 03/08/2015 4:31 PM, Glenn Schultz wrote: >> Hello All, >> >> I have a package which I would like to distri

Re: [R-pkg-devel] .tar vs. binary builds

2015-08-03 Thread Glenn Schultz
Hi Ben, I get it thanks - feedback very helpful. -Glenn   On Aug 03, 2015, at 06:06 PM, Ben Bolker wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 15-08-03 06:34 PM, Glenn Schultz wrote: Hi Ben, [Please keep the list cc'd in your replies.] Thanks for answering so qu

[R-pkg-devel] .tar vs. binary builds

2015-08-03 Thread Glenn Schultz
Hello All, I have a package which I would like to distribute.  However, there are some classes that are not exported if I provide a tar file can the user decompress the tar to the source and then export class.  I am thinking the answer is year since the tar is source code.  Conversely, a binar

[R-pkg-devel] need some help to understand package build workflow

2015-07-30 Thread Glenn Schultz
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 ... WA

[R-pkg-devel] Saving binary files in a package

2015-07-03 Thread Glenn Schultz
Hi All, I am researching the criteria for submitting packages on the R website and using Hadley's packages book as a general guide.  The CRAN policy is that a package cannot write files.  My question is as follows: Does this apply when the package is installed only?  I ask because my package