更新新版本的ggplot2代码 [英] Updating ggplot2 code for new version

查看:211
本文介绍了更新新版本的ggplot2代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

 >警告()
警告消息:
1:'opts'已弃用。
改为使用主题。
查看帮助(弃用)
2:'theme_text'已弃用。
改为使用'element_text'。
查看帮助(弃用)
8:在opts中(title = trait axis.text.x = theme_text(size = fontsize $ axis),...:
设置绘图标题opts(title =...)已被弃用,请使用labs(title =...)或ggtitle(...)来代替。 $ b

我有几个问题:


  1. help(Depreciated)返回在指定的包和库中没有'Depreciated'的文档;这是一个错误吗?

  2. 有没有一些时间'Depreciated'会变成'Obsolete',我的代码会开始抛出错误?

  3. 如何更新我的代码(解决这些问题
  4. 我可以加载ggplot2的两个版本并指定我使用的每个函数的版本是什么?

  5. 什么时间表可能会更新语法过时?

我接受这是软件的常见问题,但是perhap对于SO的一些贡献者,他们对包的作者的长期计划和基本原理有了特定的了解。 对于很多这样的事情,我会开始遵循 ggplot2-dev邮件列表和/或软件包 github存储库



您找不到任何东西的原因仅仅是因为您拼错了弃用。



要升级您的代码,请参阅过渡指南这一个。我的理解是,贬低是彻底清除的第一步,这通常会在下一个主要版本中发生。由于0.9.2刚出来,我估计下一个至少需要6-8个月,但这只是一个猜测。

=https://stackoverflow.com/q/2988559/324364>可能加载不同版本的软件包。



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


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' 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.

I have a few questions:

  1. help("Depreciated") returns "no documentation for 'Depreciated' in specified packages and libraries"; is this an error?
  2. Is there some time at which 'Depreciated' will turn to 'Obsolete' and my code will begin to throw errors?
  3. How can I update my code (to solve these specific issues and prevent others still waiting to be found)?
  4. Can I load two versions of ggplot2 and specify which version of each function I am using?
  5. On what timescale might updated syntax become obsolete?

I accept that this is a common issue with software, but perhaps some contributors to SO have specific insight into the longer term plans and rationale of the package's author.

解决方案

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!)

这篇关于更新新版本的ggplot2代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆