Skip to content

Formatting of multiple args in help file #373

@dmurdoch

Description

@dmurdoch

This was reported to me by a student, so I'm not sure there isn't some other way to do this.

He had a function definition like this:

#' Show all relevant data on a student.
#' 
#' @param totalWeighting,cpWeighting,attendanceMethod,questionMethod See \code{\link{IDToCurrentGrade}}
#' @return A list with outputs from IDToName(), AssignmentMarks(), TestMarks(), IDToNotes(), and (if testWeighting is given) IDToCurrentGrade().
#' @export
foo <- function(totalWeighting, cpWeighting, attendanceMethod, questionMethod) {
      # content deleted  
}

The .Rd file ends up with a parameter entry like this:

\arguments{
\item{totalWeighting,cpWeighting,attendanceMethod,questionMethod}{See \code{\link{IDToCurrentGrade}}}
}

The problem is that without spaces after the commas, Rd2HTML forces the whole list of parameter names onto one line. This makes the display really wide, pushing the descriptive text off screen. The browser handles the wrapping nicely if there are spaces after the commas, but you can't put those into the .R file, because Roxygen treats spaces as the marker of the beginning of the descriptive text.

So I'd suggest that Roxygen should add a space after each comma when it produces the .Rd file. Possibly this should require different input (e.g. ,) to allow the .Rd to be produced without spaces, but I don't really know any good reasons to do that.

Here's my session info:

> sessionInfo(package="roxygen2")
R version 3.2.2 (2015-08-14)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.9.5 (Mavericks)

locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8

attached base packages:
character(0)

other attached packages:
[1] roxygen2_4.1.1

loaded via a namespace (and not attached):
 [1] graphics_3.2.2      DBI_0.3.1           tools_3.2.2        
 [4] utils_3.2.2         grDevices_3.2.2     stats_3.2.2        
 [7] coursedb_0.0.0.9000 datasets_3.2.2      RSQLite_1.0.0      
[10] methods_3.2.2       base_3.2.2     

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions