Skip to content

Documenting an object may corrupt Rd formatting #562

Closed

Description

@yutannihilation

I found that sfr is not formatted well by roxygen. (r-spatial/sf#177)

Here is a minimal replex R file in my repo for proof of concept:

#' Hello, world!
#'
#' This is an example function named 'hello'
#' which prints 'Hello, world!'.
#'
#' @name hello
# Exporting object seems not allowed.
hello <- "hello"

#' @rdname hello
#' @export
how_low <- function(x) UseMethod("how_low")

#' @rdname hello
#' @export
how_low.default <- function(x) "hello"

#' @rdname hello
#' @export
how_low.character <- function(x) "Nirvana"

This will result bellow with incorrect double backslashes:

\usage{
hello

how_low(x)

\\method{how_low}{default}(x)

\\method{how_low}{character}(x)
}

I can't tell if this is a bug or intended behavior. Is this that roxygen2 does not allow us to document objects that is not a function or a dataset?

Activity

  1. added
    bugan unexpected problem or unintended behavior
    on Aug 16, 2017
  2. hadley commented on Aug 17, 2017

    @hadley
    Member

    Illustration of basic problem

    out <- roc_proc_text(rd_roclet(), "
      #' Title
      #'
      hello <- 1
      #' @rdname hello
      mean.blah <- function(x) 2")[[1]]
    out$get_field("usage")$values
    
    out <- roc_proc_text(rd_roclet(), "
      #' Title
      mean.blah <- function(x) 2")[[1]]
    
    out$get_field("usage")$values

    Looks like rd class is getting lost so that results are double escaped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions