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

2015-10-23 Thread Daniel Lüdecke
Ok, this might be a Roxygene issue, so I would close this discussion here and file an issue at GitHub for further investigation. What I found out so far: #' @rdname set_label #' @export `set_label<-` <- function(x, attr.string = NULL, value) { UseMethod("set_label<-") } #' @rdname set_label

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

2015-10-23 Thread Hadley Wickham
Here's a minimal reprex: out <- roc_proc_text(rd_roclet(), " #' Foo `foo<-` <- function(x, y, value) { UseMethod('set_labels<-') } #' Foo `foo<-.default` <- function(x, y, value) { x } ")[[2]] cat(format(out)) That generates \usage{ \method{foo}{default}(x, y) <- value }

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

2015-10-23 Thread Daniel Lüdecke
> which I believe is correct, although I don't think I've ever seen such > a construct in the wild. What would be the proper way to define such methods? Eg, I want `set_label` to work like this: x <- set_label(x, "my label") and additionally, like this: set_label(x) <- "my label" How would

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

2015-10-23 Thread Daniel Lüdecke
Ok, the "Note" is due a typo (x <- set_labels(x, values,... "values" should be "value"). But still after fixing this, the two warnings remain. Am 23.10.2015 um 10:30 schrieb Daniel Lüdecke: Hello, I don't exactly know how to name my problem, so I try to describe it. In my package (sjmisc), I

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

2015-10-23 Thread Daniel Lüdecke
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