.Deprecated() is added after each function declaration in the text. Note that it does not check for an existing .Deprecated().

add_deprecated_call(text, new = NULL)

Arguments

text

Character vector containing function declarations.

new

(Optional) Argument passed to the new call to .Deprecated().

See also

str_replace

Other modify roxygen2 documentation functions: add_deprecated_to_desc()

Examples

library(tidyverse) # Adds after each function declaration add_deprecated_call("sample_function1 <-\nfunction(a,b,c){}\n\n#' Roxygen2 Documentation\n#' Roxygen2 Lines\n\nsample_function2 <- \nfunction(x,y,z){}")
#> [1] "sample_function1 <-\nfunction(a,b,c){\n\t\t\t.Deprecated()\n}\n\n#' Roxygen2 Documentation\n#' Roxygen2 Lines\n\nsample_function2 <- \nfunction(x,y,z){\n\t\t\t.Deprecated()\n}"
# Does not skip function declarations that already makes a call to the .Deprecated function add_deprecated_call("sample_function1 <-\nfunction(a,b,c){\n.Deprecated()\n}\n\n#' Roxygen2 Documentation\n#' Roxygen2 Lines\n\nsample_function2 <- \nfunction(x,y,z){}")
#> `.Deprecated()` already in text
#> [1] "sample_function1 <-\nfunction(a,b,c){\n.Deprecated()\n}\n\n#' Roxygen2 Documentation\n#' Roxygen2 Lines\n\nsample_function2 <- \nfunction(x,y,z){}"
# Text can be a vector of length greater than 1 add_deprecated_call(c("sample_function1 <-\nfunction(a,b,c){\n.Deprecated()\n}", "#' Roxygen2 Documentation\n#' Roxygen2 Lines\n\nsample_function2 <- \nfunction(x,y,z){}"))
#> `.Deprecated()` already in text
#> [1] "sample_function1 <-\nfunction(a,b,c){\n.Deprecated()\n}" #> [2] "#' Roxygen2 Documentation\n#' Roxygen2 Lines\n\nsample_function2 <- \nfunction(x,y,z){}"