gpt4 book ai didi

R 中的 reshape 与 reshape2

转载 作者:行者123 更新时间:2023-12-03 06:10:38 26 4
gpt4 key购买 nike

我试图理解为什么开发从 reshape 转移到 reshape2 包。它们在功能上似乎是相同的,但是,由于服务器上运行的是旧版本的 R,我目前无法升级到 reshape2。我担心可能会出现一个重大错误,该错误会将开发转移到一个全新的软件包,而不是简单地继续开发reshape。有谁知道 reshape 包是否存在重大缺陷?

最佳答案

reshape2 让 Hadley 重新启动reshape,速度更快,同时避免破坏人们的依赖和习惯。

https://stat.ethz.ch/pipermail/r-packages/2010/001169.html

Reshape2 is a reboot of the reshape package. It's been over five years since the first release of the package, and in that time I've learned a tremendous amount about R programming, and how to work with data in R. Reshape2 uses that knowledge to make a new package for reshaping data that is much more focussed and much much faster.

This version improves speed at the cost of functionality, so I have renamed it to reshape2 to avoid causing problems for existing users. Based on user feedback I may reintroduce some of these features.

What's new in reshape2:

  • considerably faster and more memory efficient thanks to a much better underlying algorithm that uses the power and speed of subsetting to the fullest extent, in most cases only making a single copy of the data.

  • cast is replaced by two functions depending on the output type: dcast produces data frames, and acast produces matrices/arrays.

  • multidimensional margins are now possible: grand_row and grand_col have been dropped: now the name of the margin refers to the variable that has its value set to (all).

  • some features have been removed such as the | cast operator, and the ability to return multiple values from an aggregation function. I'm reasonably sure both these operations are better performed by plyr.

  • a new cast syntax which allows you to reshape based on functions
    of variables (based on the same underlying syntax as plyr):

  • better development practices like namespaces and tests.

关于R 中的 reshape 与 reshape2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12377334/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com