11

自从安装最新版本的 ggplot2 (0.9.1) 以来,我一直从我的旧代码中收到消息,包括:

> warnings()
Warning messages:
1: 'opts' is deprecated.
Use 'theme' instead.
See help("Deprecated")
2: 'theme_text' is deprecated.
Use 'element_text' instead.
See help("Deprecated")
8: In opts(title = trait axis.text.x = theme_text(size = fontsize$axis),  ... :
  Setting the plot title with opts(title="...") is deprecated. Use labs(title="...") or ggtitle("...") instead.
9: 'opts' is deprecated.

我有几个问题:

  1. help("Depreciated") 返回"no documentation for 'Depreciated' in specified packages and libraries";这是一个错误吗?
  2. 是否有一段时间'Depreciated' 会变成'Obsolete' 并且我的代码会开始抛出错误?
  3. 如何更新我的代码(以解决这些特定问题并防止其他人仍在等待被发现)?
  4. 我可以加载两个版本的 ggplot2 并指定我使用的每个函数的版本吗?
  5. 更新的语法在什么时间范围内可能会过时?

我承认这是软件的常见问题,但也许 SO 的一些贡献者对包作者的长期计划和基本原理有具体的见解。

4

2 回答 2

21

Winston 的 github wiki中,关键的变化是:

  1. theme_xx()功能改为element_xx()

    theme_segment()纳入theme_line()

  2. opts()变成theme()

  3. opts(title = "mytitle")变成labs(title = "mytitle")

  4. 使编程更容易的新功能,例如ggtitle("mytitle")与 #3 相同

这是我更新的一些功能的差异:

于 2014-01-16T21:57:19.923 回答
10

对于其中许多事情,我会开始关注ggplot2-dev 邮件列表和/或包github 存储库

你没有找到任何东西的原因仅仅是因为你拼错了“deprecated”。

要升级您的代码,请参阅此转换指南。我的理解是,弃用是完全删除的第一步,这通常会在下一个“主要”版本中发生。由于 0.9.2 刚刚发布,我猜下一个至少需要 6-8 个月,但这只是一个猜测。

可以加载不同版本的包

(小点:最新版本是0.9.2.1!)

于 2012-10-30T21:56:45.403 回答