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
#' @export
`set_label<-.default` <- function(x, attr.string = NULL, value) {
  x <- set_label(x, value, attr.string)
  x
}


creates following rd-file:

% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/set_label.R
\name{set_label}
\alias{set_label}
\alias{set_label<-}
\alias{set_label<-.default}
\alias{set_var_labels}
\title{Add variable label(s) to variables}
\usage{
set_label(x, lab, attr.string = NULL)

set_var_labels(x, lab, attr.string = NULL)

set_label(x, attr.string = NULL) <- value

\method{set_label}{default}(x, attr.string = NULL) <- value
}


while

#' @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, value, force.labels, force.values)
  x
}


results in

% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/set_labels.R
\name{set_labels}
\alias{set_labels}
\alias{set_labels<-}
\alias{set_labels<-.default}
\alias{set_val_labels}
\title{Add value labels to variables}
\usage{
set_labels(x, labels, force.labels = FALSE, force.values = TRUE)

set_val_labels(x, labels, force.labels = FALSE, force.values = TRUE)

set_labels(x, force.labels = FALSE, force.values = TRUE) <- value

\method{set_labels}{default}(x, force.labels = FALSE, force.values = TRUE)
  <- value
}


There's a carriage return (or similar) in the generated rd-file which throws the warning message in the check procedure. I cam up with removing "#' @rdname set_labels", because 1) it works fine then and 2) my index-page of the package help does not list redundant function names multiple times.

Best
Daniel



Am 23.10.2015 um 13:10 schrieb 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
}

which I believe is correct, although I don't think I've ever seen such
a construct in the wild.

Duncan: does that look right to you? (i.e. is that what the usage of
method of a replacement function should look like?)

Hadley

On Fri, Oct 23, 2015 at 3:30 AM, Daniel Lüdecke <d.luede...@uke.de> 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, ...) {
...
}

--

_____________________________________________________________________

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

Reply via email to