You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
formatting a R6 object with roxygen2 documentation fails with:
tidying /tmp/r6.R
Error in base::parse(text = code, keep.source = FALSE) :
<text>:7:1: unexpected symbol
6: invisible(".BeGiN_TiDy_IdEnTiFiEr_HaHaHa#' @field name First or full name of the person..HaHaHa_EnD_TiDy_IdEnTiFiEr")
7: name
It would be nice to have this formated in an nice way.
cat > /tmp/r6.R << 'EOF'
#' R6 Class representing a person
#'
#' A person has a name and a hair color.
Person <- R6::R6Class("Person",
public = list(
#' @field name First or full name of the person.
name = NULL,
#' @field hair Hair color of the person.
hair = NULL,
#' @description
#' Create a new person object.
#' @param name Name.
#' @param hair Hair color.
#' @return A new `Person` object.
initialize = function(name = NA, hair = NA) {
self$name <- name
self$hair <- hair
self$greet()
},
#' @description
#' Change hair color.
#' @param val New hair color.
#' @examples
#' P <- Person("Ann", "black")
#' P$hair
#' P$set_hair("red")
#' P$hair
set_hair = function(val) {
self$hair <- val
},
#' @description
#' Say hi.
greet = function() {
cat(paste0("Hello, my name is ", self$name, ".\n"))
}
)
)
EOF
Rscript -e 'formatR::tidy_file("/tmp/r6.R")'
version info
R version 3.6.0 (2019-04-26)
Platform: x86_64-conda_cos6-linux-gnu (64-bit)
Running under: KDE neon User Edition 5.18
I have provided the necessary information about my issue.
If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('formatR'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('yihui/formatR').
If I have posted the same issue elsewhere, I have also mentioned it in this issue.
I have learned the Github Markdown syntax, and formatted my issue correctly.
I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered:
formatting a R6 object with roxygen2 documentation fails with:
It would be nice to have this formated in an nice way.
code to reproduce:
code of the R6 is taken from https://www.tidyverse.org/blog/2019/11/roxygen2-7-0-0/
version info
By filing an issue to this repo, I promise that
xfun::session_info('formatR')
. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('yihui/formatR')
.I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered: