Ok, this seems to work!
Though I don't know why there's a warning, because in another function I
use @rdname as described before, which doesn't give a warning.
Best
Daniel
Am 23.10.2015 um 10:37 schrieb 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
Daniel Lüdecke, Dr. phil.
Universitätsklinikum Hamburg-Eppendorf
Zentrum für Psychosoziale Medizin
Institut für Medizinische Soziologie
W37, 8. Stock
Martinistr. 52
D-20246 Hamburg
Tel: +49 (0)1515 2494757
Tel: +49 (0)40 7410 52878
--
_____________________________________________________________________
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