错误找不到“%>%”。编织到HTML时?
初学者
抱歉,我是R:它在R-MarkDown中运行的
,但是当我想将其编织到HTML时,它给出了: PDB%>%filter中的错误(human,canonical_marker ... 找不到函数“%>%”调用...可见的 - > eval_with_user_handlers->评估 - >评估执行
在此停止了代码:
knitr::opts_chunk$set(echo = TRUE)
# Install packages
if (!requireNamespace("devtools", quietly = TRUE)) {
install.packages("devtools")
}
if (!requireNamespace("Seurat", quietly = TRUE)) {
install.packages("Seurat")
}
if (!requireNamespace("OmnipathR", quietly = TRUE)) {
devtools::install_github("saezlab/OmnipathR")
}
if (!requireNamespace("decoupleR", quietly = TRUE)) {
devtools::install_github("saezlab/decoupleR")
}
if (!requireNamespace("dplyr", quietly = TRUE)) {
install.packages("dplyr")
}
if (!requireNamespace("tibble", quietly = TRUE)) {
install.packages("tibble")
}
if (!requireNamespace("tidyr", quietly = TRUE)) {
install.packages("tidyr")
}
if (!requireNamespace("ggplot2", quietly = TRUE)) {
install.packages("ggplot2")
}
if (!requireNamespace("pheatmap", quietly = TRUE)) {
install.packages("pheatmap")
}
if (!requireNamespace("patchwork", quietly = TRUE)) {
install.packages("patchwork")
}
if (!requireNamespace("ggrepel", quietly = TRUE)) {
install.packages("ggrepel")
}
# Load dependencies
library (devtools)
library(OmnipathR)
library(Seurat)
library(decoupleR)
library(dplyr)
library(tidyr)
library(tibble)
library(ggplot2)
library(pheatmap)
library(patchwork)
library(ggrepel)
data <- readRDS('~/data.rds')
data
# Get resource from OmniPath
pdb <- decoupleR::get_resource(name='PanglaoDB')
pdb
pdb <- pdb %>%
filter(human, canonical_marker, organ == 'Immune system') %>%
distinct(cell_type, genesymbol)
pdb
Sorry I am quite a beginner with R:
It runs in the R-markdown, but when I want to knit it to html, it gives this:
Error in pdb %>% filter(human, canonical_marker...
could not find function "%>%" Calls ...withVisible -> eval_with_user_handlers -> eval -> eval Execution halted
Here the code:
knitr::opts_chunk$set(echo = TRUE)
# Install packages
if (!requireNamespace("devtools", quietly = TRUE)) {
install.packages("devtools")
}
if (!requireNamespace("Seurat", quietly = TRUE)) {
install.packages("Seurat")
}
if (!requireNamespace("OmnipathR", quietly = TRUE)) {
devtools::install_github("saezlab/OmnipathR")
}
if (!requireNamespace("decoupleR", quietly = TRUE)) {
devtools::install_github("saezlab/decoupleR")
}
if (!requireNamespace("dplyr", quietly = TRUE)) {
install.packages("dplyr")
}
if (!requireNamespace("tibble", quietly = TRUE)) {
install.packages("tibble")
}
if (!requireNamespace("tidyr", quietly = TRUE)) {
install.packages("tidyr")
}
if (!requireNamespace("ggplot2", quietly = TRUE)) {
install.packages("ggplot2")
}
if (!requireNamespace("pheatmap", quietly = TRUE)) {
install.packages("pheatmap")
}
if (!requireNamespace("patchwork", quietly = TRUE)) {
install.packages("patchwork")
}
if (!requireNamespace("ggrepel", quietly = TRUE)) {
install.packages("ggrepel")
}
# Load dependencies
library (devtools)
library(OmnipathR)
library(Seurat)
library(decoupleR)
library(dplyr)
library(tidyr)
library(tibble)
library(ggplot2)
library(pheatmap)
library(patchwork)
library(ggrepel)
data <- readRDS('~/data.rds')
data
# Get resource from OmniPath
pdb <- decoupleR::get_resource(name='PanglaoDB')
pdb
pdb <- pdb %>%
filter(human, canonical_marker, organ == 'Immune system') %>%
distinct(cell_type, genesymbol)
pdb
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这有点晚了,但我想我会留下答案。
我运行您的确切代码,并且在没有错误的情况下正确执行。
也许尝试重新安装“ Magrittr”软件包。
顺便说一句,您仅在编织降价时才会遇到此错误?
This is a bit late but I thought I'd leave an answer.
I run your exact code and it executed correctly with no errors.
Maybe try to re-install the "magrittr" package.
Btw are you getting this error only when knitting the markdown?