Here's a test source file:
#' A function with argument names defined using backticks
#'
#' More information about this function.
#'
#' @param `arg 1` a number
#' @param `arg 2` a string
#'
#' @return the string `"goodbye"`
#' @export
#'
#' @examples
#' function_with_backticked_arg_names()
function_with_backticked_arg_names = function(
`arg 1` = 1,
`arg 2` = "apple")
{
print(`arg 1`)
print(`arg 2`)
return('goodbye')
}
Here's what I get:
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/function_with_backticked_arg_names.R
\name{function_with_backticked_arg_names}
\alias{function_with_backticked_arg_names}
\title{A function with argument names defined using backticks}
\usage{
function_with_backticked_arg_names(`arg 1` = 1, `arg 2` = "apple")
}
\arguments{
\item{`arg}{2` a string}
}
\value{
the string \code{"goodbye"}
}
\description{
More information about this function.
}
\examples{
function_with_backticked_arg_names()
}
Note that arg 1
is totally missing from the documentation, and arg 2
has gotten parsed incorrectly (I think?).
In case it's helpful, I created a test package with this function included and renv
activated, here:
I realize that using backticks in argument names is probably a rare practice, but I use them somewhat frequently, for example so that I can use conditional probability expressions, such as p(X|Y)
, as arguments.