Updating ggplot2 code for new version

后端 未结 2 1183
轮回少年
轮回少年 2021-01-17 17:01

Since installing the latest version of ggplot2 (0.9.1), I have been getting messages from my old code including:

> warnings()
Warning messages:
1: \'opts\         


        
相关标签:
2条回答
  • 2021-01-17 17:58

    From Winston's github wiki, the key changes are:

    1. theme_xx() functions changed to element_xx()

      theme_segment() incorporated into theme_line()

    2. opts() changed to theme()

    3. opts(title = "mytitle") changed to labs(title = "mytitle")

    4. New features that make programming easier, e.g. ggtitle("mytitle") does the same as #3

    Here is a diff of some functions that I updated:

    0 讨论(0)
  • 2021-01-17 17:59

    For many of these things, I'd start following the ggplot2-dev mailing list, and/or the packages github repository.

    The reason you were not finding anything was simply because you had misspelled "deprecated".

    For upgrading your code, see this transition guide or this one. My understanding is that deprecation is the first step in total removal, which would typically happen in the next "major" release. Since 0.9.2 just came out, I'd guess the next one is at least 6-8 months away, but that's just a guess.

    It is possible to load different versions of a package.

    (Minor point: the latest version is 0.9.2.1!)

    0 讨论(0)
提交回复
热议问题