如何在R中安装pivot_long()和pivot_wide() [英] How to install pivot_long() and pivot_wide() in R
问题描述
如果要尝试这些新功能(pivot_wide
和pivot 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屋!