如何在R中安装pivot_long()和pivot_wide() [英] How to install pivot_long() and pivot_wide() in R

查看:307
本文介绍了如何在R中安装pivot_long()和pivot_wide()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果要尝试这些新功能(pivot_widepivot long),则需要安装tidyr的开发版本:

If you want to try these new functions (pivot_wide and pivot long), you need to install the development version of tidyr:

devtools::install_github("tidyverse/tidyr").

但是我没有实现它.我安装了一个库列表,除了一个库(vctrs),我不知道这是否是问题.

But I have not managed to achieved it. I install a list of libraries except one, ( vctrs) and I don't know if that's the problem.

当我运行下一个代码时:

When I run the next code:

  mtcars_wide1 <- mtcars %>%
  pivot_wide(names_from = "am",
             values_from = "mpg")

R找不到功能.

在此处输入图片描述

你能推荐我一些东西吗?

Can you recommend me something?

推荐答案

您可能没有安装R的最新版本-当前最新版本为3.6.1.

You probably don't have the lasted version of R installed - the latest is currently 3.6.1.

R.version

我和您有同样的问题,但是我

I had the same problem as you, but I updated R, reinstalled the dev version of the tidyverse

install.packages("devtools")
devtools::install_github("hadley/tidyverse")

...而且一切都很好.希望它也对您有用!

…and all was good. Hope it works for you too!

这篇关于如何在R中安装pivot_long()和pivot_wide()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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