r - 使用对频率计数追踪 R 错误
问题描述
几天前这段代码运行良好,但现在它已经坏了:
links <- data.frame(source= c(1:3,4,6,8,10,10,12), target= c(1:3,5,1,10,4,4,9))
#View(links)
#source target
# 1 1
# 2 2
# 3 3
# 4 5
# 6 1
# 8 10
# 10 4
# 10 4
# 12 9
relations <- links %>%
dplyr::group_by(source, target) %>%
count()
#View(relations) #Just getting one column with 2 everytime??
# V1
# 2
#Should've been and it used to be-
#source target count
# 1 1 1
# 2 2 1
# 3 3 1
# 4 5 1
# 6 1 1
# 8 10 1
# 10 4 2
# 12 9 1
Have tried %>% summarize(count =n()) too, no luck.
这个表达式一直工作到现在,今天早上重新运行代码,尝试回溯,我不知道这是怎么回事。
解决方案
(代表问题作者发布解决方案以将其移至答案空间)。
rawr 和 akrun 给出了解决方案,基本上是我错过了count()
函数的范围解析,应该是dplyr::count()
.
推荐阅读
- regex - 使用 RegEx 捕获所有出现的事件
- c# - 如何在基于 .NET 的非 GUI 应用程序中打印?
- r - R中的WebScraping:从`href`标签中提取名称
- unity3d - 更改对象比例后对撞机不起作用
- c - 在不使用分号的情况下打印“hello world”的概念帮助
- javascript - 独立于 ID 复制输入字段的通用函数
- android - 如何在 Win 10 中构建 NDK 工具链
- c# - 如何使用cultureInfo 获取国家名称并进行翻译?
- python - 跨列删除具有相同单元格值的任何行
- python - aws lambda:如何使用 chromium-headless “DevToolsActivePort 文件不存在”修复错误