Comments (3)
I am reopening this issue now based on @hadley's suggestion on SO.
If I roxygenise
the following function:
#' Setter function
#' @param x an R object
#' @param value a character value to set
#' @export
`foo<-` <- function(x, value){
attr(x, 'foo') <- value
return(x)
}
I get the following Rd
file:
\name{foo<-}
\alias{foo<-}
\title{Setter function}
\usage{
foo(x, value) <- value
}
\arguments{
\item{x}{an R object}
\item{value}{a character value to set}
}
\description{
Setter function
}
Where the usage tag is not formed correctly.
from roxygen2.
This update to process.usage
fixes the issue (for roxygen2
).
process.usage <- function(partitum) {
if (is.null(partitum$fun) || !partitum$fun) {
return(new_tag("usage", NULL))
}
if (!is.null(partitum$usage)) {
return(new_tag("usage", partitum$usage))
}
fun_name <- if (!is.null(partitum$method)) {
rd_tag('method', partitum$method[[1]], partitum$method[[2]])
} else {
partitum$assignee
}
is_setter_fun <- str_detect(fun_name, fixed("<-"))
if(is_setter_fun) {
partitum$formals["value"] <- NULL
}
args <- usage(partitum$formals)
if (is_setter_fun) {
fun_name <- str_replace(fun_name, fixed("<-"), "")
new_tag("usage", str_c(fun_name, "(", args, ") <- value"))
} else {
new_tag("usage", str_c(fun_name, "(", args, ")"))
}
}
from roxygen2.
Fixed in roxygen3 (https://github.com/hadley/roxygen3). This is not yet suitable for use, but it has (I think) a better design, so it's where I'm fixing bugs.
from roxygen2.
Related Issues (20)
- `reexports.Rd` re-writes `lubridate` functions re-exported HOT 1
- If no public methods provided and cloneable is `FALSE`, roxygen2 will failed
- Always resolve to "anchored" Rd xrefs HOT 5
- @export generates a wrong NAMESPACE directive for S3 methods of generics imported from a different package
- Allow for width/height setting when specifying an external image via markdown
- Unnecessary escaping of `%` inside multi-line character in R
- Improve indentation/wrapping for named vectors/lists in `\usage{}` blocks
- FR: add `is_md` to `parse_file()`
- The language is not respected when running inline code
- Homegrown `local_reproducible_output()` should set `cli.hyperlink = FALSE`
- `\usage()` length HOT 1
- Markdown support for definition lists?
- Document that aliases should be documented 1 per line
- Unnecessary and undocumented space in family functions
- Release roxygen2 7.3.2
- Move to R 4.0.0 dependency
- `@inheritParams` and `\linkS4class{}`
- Error when warn_missing_s3_exports is called.
- Usage section not automatically rendered for iSEE method HOT 1
- Links to other helps documents in child docs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from roxygen2.