Re: [R-pkg-devel] FW: CRAN submission berryFunctions 1.8.0

2015-06-03 Thread Kirill Müller
Note that current devtools 1.8.0 attempts to use the spell checker when 
you say devtools::check(check_version = TRUE), and warns if no spell 
checker could be found. Perhaps a simpler option is to build on 
win-builder before submission (e.g., by running devtools::build_win() ), 
which is a good idea unless your package doesn't support Windows.



Best regards

Kirill


On 03.06.2015 09:51, Uwe Ligges wrote:



On 03.06.2015 09:48, Berry Boessenkool wrote:


Hi,

after submitting my package update, CRAN (Brian Ripley) found a 
couple of warnings / messages.
URLs that are not longer existent, a non-ASCII character from 
copypasting, incorrect title case.

Stuff that I should and could definitely solve before submitting.

Why did the latest Rdevel (2015-06-01 r68455) CMD check --as-cran not 
find them?


Your R was not libcurl enabled nor had you the spellchecker installed, 
I guess.


Best,
Uwe Ligges



Below are the relevant excerpts.

Thanks for any hints about what I may have done wrong,
Berry

-


Found the following (possibly) invalid URLs:
URL: http://cran.r-project.org/web/packages/denstrip (moved to
http://cran.r-project.org/web/packages/denstrip/)
  From: man/betaPlot.Rd
man/normPlot.Rd
  Status: 200
  Message: OK
  CRAN URL not in canonical form



URL: http://www.geolinde.musin.de/afrika/pic/klimamuenchen.gif
  From: man/climateGraph.Rd
  Status: 404
  Message: Not Found


[...]


The canonical URL of the CRAN page for a package is
http://cran.r-project.org/package=pkgname




No package encoding and non-ASCII characters in the following R files:
R/groupHist.R
  19: # ignore messages like: argument col is not made use of



The Title field should be in title case, current version then in 
title case:

�Function Collection related to Plotting and Hydrology�
�Function Collection Related to Plotting and Hydrology�




[[alternative HTML version deleted]]



__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel



__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] S3 method, useMethod and <-, using Roxygen

2015-10-23 Thread Kirill Müller
values -> value is a typo in the implementation of .default(). I'm not 
sure you need to document the .default() function (the second @rdname 
set_labels). If this doesn't help, you could try renaming set_labels() 
to avoid collisions.



Best regards

Kirill


On 23.10.2015 10:30, Daniel Lüdecke wrote:

Hello,
I don't exactly know how to name my problem, so I try to describe it.

In my package (sjmisc), I have a function to set label attributes to 
vectors:


set_labels <- function(x, labels, ...) {
...
}

Usage would be:
x <- set_labels(x, c("lo", "high"))


No I wanted to also add functionality to directly change a value:
set_labels(x) <- c("lo", "high")


So I added this to my package source:

#' @rdname set_labels
#' @export
`set_labels<-` <- function(x, force.labels = FALSE, force.values = 
TRUE, value) {

  UseMethod("set_labels<-")
}

#' @rdname set_labels
#' @export
`set_labels<-.default` <- function(x, force.labels = FALSE, 
force.values = TRUE, value) {

  x <- set_labels(x, values, force.labels, force.values)
  x
}


However, running the check gives following note and warnings:

* checking R code for possible problems ... NOTE
set_labels<-.default: no visible binding for global variable 'values'
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd line widths ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... WARNING
Functions or methods with usage in documentation object 'set_labels' 
but not in code:

  set_labels.default

* checking Rd \usage sections ... WARNING
Objects in \usage without \alias in documentation object 'set_labels':
  'set_labels.default'

Bad \usage lines found in documentation object 'set_labels':
<- value

Functions with \usage entries need to have the appropriate \alias
entries, and all their arguments documented.
The \usage entries must correspond to syntactically valid R code.
See chapter 'Writing R documentation files' in the 'Writing R
Extensions' manual.


I don't know what to do here. Any help is appreciated!

Thanks in advance
Daniel
--

_

Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen 
Rechts; Gerichtsstand: Hamburg | www.uke.de
Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender), Prof. Dr. 
Dr. Uwe Koch-Gromus, Joachim Prölß, Rainer Schoppik

_

SAVE PAPER - THINK BEFORE PRINTING
__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Re: [R-pkg-devel] Problems with :::

2016-01-28 Thread Kirill Müller

On 28.01.2016 14:20, Duncan Murdoch wrote:
If the class is just "mytable", then you'll have to change it to 
"ftable" before calling stats::format(). 
Side note: The following will fail, because format.ftable double-checks 
the class of its argument:


format_ftable <- utils::getS3method("format", "ftable")
format_ftable(mytable)


-Kirill

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Namespace error

2016-02-23 Thread Kirill Müller
It's difficult to tell without seeing the source code, but the NAMESPACE 
you posted doesn't seem to contain "View". This file usually gets 
updated when you call devtools::document() or roxygen2::roxygenize(). 
What happens if you run one of these functions?



-Kirill


On 16.02.2016 18:14, Glenn Schultz wrote:

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) : undefined exports: View
Error: package or namespace load failed for ‘BondLab’
Execution halted
* checking whether the namespace can be loaded with stated 
dependencies ... WARNING

Error in namespaceExport(ns, exports) : undefined exports: View
Calls: loadNamespace ... namespaceImportFrom -> asNamespace -> 
loadNamespace -> namespaceExport

Execution halted

A namespace must be able to be loaded with just the base namespace
loaded: otherwise if the namespace gets loaded by a saved object, the
session will be unable to start.

Probably some imports need to be declared in the NAMESPACE file.
* checking whether the namespace can be unloaded cleanly ... OK
* checking dependencies in R code ... NOTE
Error: package or namespace load failed for ‘BondLab’
Call sequence:
2: stop(gettextf("package or namespace load failed for %s", 
sQuote(package)), call. = FALSE, domain = NA)



Here is my namespace:

# Generated by roxygen2: do not edit by hand

export(AtomsData)
export(BeginBal)
export(Bond)
export(BondAnalytics)
export(BondBasisConversion)
export(BondCashFlows)
export(CDR.To.MDR)
export(CIRBondPrice)
export(CIRSim)
export(CPR.To.SMM)
export(CalibrateCIR)
export(CashFlowTable)
export(CollateralGroup)
export(CusipRecord)
export(DollarRoll)
export(DollarRollAnalytics)
export(Effective.Convexity)
export(Effective.Duration)
export(Effective.Measure)
export(EndingBal)
export(EstimYTM)
export(Forward.Rate)
export(ForwardPassThrough)
export(HPISim)
export(Interest)
export(MBS)
export(MakeBondDetails)
export(MakeCollateral)
export(MakeMBSDetails)
export(MakeModelTune)
export(MakeRAID)
export(MakeRDME)
export(MakeScenario)
export(MakeSchedule)
export(MakeTranche)
export(ModelTune)
export(Mortgage.Monthly.Payment)
export(Mortgage.OAS)
export(MortgageCashFlow)
export(MortgageCashFlowArray)
export(MortgageCashFlow_Array)
export(MortgageRate)
export(Mtg.Scenario)
export(MtgRate)
export(MtgTermStructure)
export(PPC.Ramp)
export(PassThroughOAS)
export(PaymentDate)
export(PrepaymentAssumption)
export(RDMEData)
export(RDMEFactor)
export(REMICDeal)
export(REMICGroupConn)
export(REMICSchedules)
export(REMICWaterFall)
export(Rates)
export(ReadRAID)
export(Remain.Balance)
export(RemicStructure)
export(SMM.To.CPR)
export(SMMVector.To.CPR)
export(SaveCollGroup)
export(SaveMBS)
export(SaveModelTune)
export(SaveRAID)
export(SaveRDME)
export(SaveREMIC)
export(SaveScenario)
export(SaveSchedules)
export(SaveTranche)
export(SaveTranches)
export(ScenarioCall)
export(Sched.Prin)
export(SwapRateData)
export(TermStructure)
export(TimeValue)
export(Tranches)
export(ULTV)
export(bondprice)
exportClasses(AtomsAnalytics)
exportClasses(AtomsData)
exportClasses(AtomsScenario)
exportClasses(BondCashFlows)
exportClasses(BondDetails)
exportClasses(BondTermStructure)
exportClasses(MBSDetails)
exportClasses(TermStructure)
import(data.tree)
import(methods)
import(optimx)
importFrom(lubridate,"%m+%")
importFrom(lubridate,day)
importFrom(lubridate,month)
importFrom(lubridate,year)
importFrom(lubridate,years)
importFrom(termstrc,create_cashflows_matrix)
importFrom(termstrc,create_maturities_matrix)
importFrom(termstrc,estim_cs)
importFrom(termstrc,estim_nss)
importFrom(termstrc,forwardrates)
importFrom(termstrc,spotrates)
__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Re: [R-pkg-devel] Scripts to generate data objects

2016-03-31 Thread Kirill Müller
The devtools::use_data_raw() function creates a "data-raw" directory for 
this purpose, and adds it to .Rbuildignore so that it's not included in 
the built package. Your scripts can then write the data to the proper 
place using devtools::use_data().



-Kirill


On 30.03.2016 14:03, Iago Mosqueira wrote:

Hello,

What is the best way of keeping R scripts that are used to generate the data 
files in the data/ folder? These are not meant to be available to the user, but 
I would like to keep them in the package itself. Right now I am storing them 
inside data/, for example PKG/data/datasetone.R to create 
PKG/data/dataseton.RData, and then adding those R files to .Rbuildignore.

Are there any other sensible ways of doing this?

Thanks,


Iago






[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


[R-pkg-devel] S3 dispatch for select()

2017-05-24 Thread Kirill Müller

Hi


When a package defines a select() generic, objects of type list seem to 
be forcibly dispatched to utils::select.list(). This is not the case 
when the generic is defined in a regular R script. I could define a 
select__() generic and forward all select() calls to select__() first, 
but I wonder if there's a better way. Thanks.


Examples below, the first needs the *select* package [1].


Best regards

Kirill


[1] https://github.com/krlmlr/select


# 1. From package:

library(select)
select(letters)
#> [1] "select.default"
select(1:3)
#> [1] "select.default"
select(list(1:3))
#> Error in select.list(list(1:3)): select.list() cannot be used 
non-interactively



# 2. From script

select <- function(x, ...) UseMethod("select")

select.default <- function(x, ...) "select.default"

select.list <- function(x, ...) "select.list"

select(letters)
#> [1] "select.default"
select(1:3)
#> [1] "select.default"
select(list(1:3))
#> [1] "select.list"

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] active bindings in package namespace

2019-03-23 Thread Kirill Müller

Dear Jack


This doesn't answer your question, but I would advise against this design.

- Users do not expect side effects (such as network access) from 
accessing a symbol.


- A function gives you much more flexibility to change the interface 
later on. (Arguments for fetching the data, tokens for API access, ...)


- You already encountered a few quirks that make this an "interesting" 
problem.


A function call only needs a pair of parentheses.


Best regards

Kirill


On 23.03.19 16:50, Jack O. Wasey wrote:

Dear all,

I am developing a package which is a front for various online data 
(icd.data https://github.com/jackwasey/icd.data/ ). The current CRAN 
version just has lazy-loaded data, but now the package encompasses far 
more current and historic ICD codes from different countries, these 
can't be included in the CRAN package even with maximal compression.


Other authors have solved this using functions to get the data, with 
or without a local cache of the retrieved data. No CRAN or other 
packages I have found after extensive searching use the attractive 
active binding feature of R.


The goal is simple: for the user to refer to the data by its symbol, 
e.g., 'icd10fr2019', or 'icd.data::icd10fr2019', and it will be 
downloaded and parsed transparently (if the user has already granted 
permission, or after prompt if they haven't).


The bindings are set using commands alongside the function definitions 
in R/*.R .E.g.


makeActiveBinding("icd10cm_latest", .icd10cm_latest_binding, 
environment())

lockBinding("icd10cm_latest", environment())

For non-interactive use, CI and CRAN tests, no data should be 
downloaded, and no cache directory set up without user consent. For 
interactive use, I ask permission to create a local data cache before 
downloading data.


This works fine... until R CMD check. The following steps seems to 
'get' or 'source' everything from the package namespace, which results 
in triggering the active bindings, and this fails if I am unable to 
get consent to download data, and want to 'stop' on this error condition.

 - checking dependencies in R code
 - checking S3 generic/method consistency
 - checking foreign function calls
 - checking R code for possible problems

Debugging CI-specific binding bugs is a nightmare because these occur 
in different R sessions initiated by R CMD check.


There may be legitimate reasons to evaluate everything in the 
namespace, but I've no idea what they are. Incidentally, Rstudio also 
does 'mget' on the whole package namespace and triggers bindings 
during autocomplete. https://github.com/rstudio/rstudio/issues/4414


Is this something I should raise as an issue with R? Or does anyone 
have any idea of a sensible approach to this. Currently I have a set 
of workarounds, but this complicates the code, and has taken an awful 
lot of time. Does anyone know of any CRAN package which has active 
bindings in the package namespace?


Any ideas appreciated.

Jack Wasey

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel