Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting of multiple args in help file #373

dmurdoch opened this issue Sep 1, 2015 · 1 comment

Formatting of multiple args in help file #373

dmurdoch opened this issue Sep 1, 2015 · 1 comment


Copy link

dmurdoch commented Sep 1, 2015

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:

\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)

[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:

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     
Copy link

hadley commented Sep 2, 2015

Yeah, I've noticed that too. I'll fix when I'm next working on roxygen2

@hadley hadley closed this as completed in 9d314c6 Oct 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants