错误找不到“%>%”。编织到HTML时?

发布于 2025-01-29 07:33:34 字数 1810 浏览 5 评论 0原文

初学者

抱歉,我是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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

差↓一点笑了 2025-02-05 07:33:34

这有点晚了,但我想我会留下答案。

我运行您的确切代码,并且在没有错误的情况下正确执行。
也许尝试重新安装“ 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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文