Giter Site home page Giter Site logo

Incongrous function name about bbplot HOT 2 OPEN

bbc avatar bbc commented on June 26, 2024 5
Incongrous function name

from bbplot.

Comments (2)

gregorp avatar gregorp commented on June 26, 2024 3

Meant to add in my original post that it looks lovely :)

If you want to make this change internally as well, a nice way to go about renaming (to not break any existing code) is to make a copy. Rename the theme theme_bbc and add the line

bbc_style <- theme_bbc

Try to wean off of bbc_style. In a couple months, change it to

bbc_style <- function() {
  warning("bbc_style is on a deprecation, please use theme_bbc() instead")
  theme_bbc()
}

Eventually upgrade the warning to an error

bbc_style <- function() {
  stop("bbc_style is deprecated, please use theme_bbc() instead")
}

from bbplot.

jonocarroll avatar jonocarroll commented on June 26, 2024 3

FYI, there's a canonical way to achieve this:

## soft deprecate a function
bbc_style <- function() {
  .Deprecated("theme_bbc")
  
  ## existing code
  list(a = 2, b = 3)
}
## produces a warning
bbc_style()
#> Warning: 'bbc_style' is deprecated.
#> Use 'theme_bbc' instead.
#> See help("Deprecated")
#> $a
#> [1] 2
#> 
#> $b
#> [1] 3

## hard deprecate a function
bbc_style <- function() {
  .Defunct("theme_bbc")
}
## produces an error
bbc_style()
#> Error: 'bbc_style' is defunct.
#> Use 'theme_bbc' instead.
#> See help("Defunct")

from bbplot.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.