【问题标题】:Error cannot find "%>%" when knitting to html?编织到html时出错找不到\"%>%\"?
【发布时间】:2022-10-24 16:15:21
【问题描述】:

抱歉,我是 R 的初学者:

它在 R-markdown 中运行,但是当我想将它编织成 html 时,它给出了这个:

pdb %>% 过滤器中的错误(人类,canonical_marker... 找不到函数“%>%”调用 ...withVisible -> eval_with_user_handlers -> eval -> eval 执行停止

这里的代码:

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

【问题讨论】:

    标签: html filter knitr pdb


    【解决方案1】:

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

    我运行了您的确切代码,它正确执行,没有错误。 也许尝试重新安装“magrittr”包。

    顺便说一句,您是否仅在编织降价时才收到此错误?

    【讨论】:

      猜你喜欢
      • 2017-12-04
      • 2021-02-08
      • 2019-02-05
      • 2017-03-13
      • 1970-01-01
      • 2016-06-26
      • 1970-01-01
      • 1970-01-01
      • 2020-04-26
      相关资源
      最近更新 更多