r - 如何过滤掉R中的一个因素
问题描述
我想过滤掉一个因素,以便可以将 ggplot 与其余因素一起绘制,我尝试了以下方法,但没有奏效:
library(ggplot2)
figvad <- read.csv(url("https://raw.githubusercontent.com/learnseq/learning/main/vadev.txt"),sep = '\t',header = TRUE)
figvadc <- figvad %% c(!=Pre-clinical)
我也用过:
library(tidyverse)
library(ggplot2)
figvad <- read.csv(url("https://raw.githubusercontent.com/learnseq/learning/main/vadev.txt"),sep = '\t',header = TRUE)
figvadclinic<-figvad %>%
rownames_to_column("Type") %>%
filter(stringr::str_detect(type, 'Pre-clinical') )
library(repr, warn.conflicts = FALSE)
options(repr.plot.width=17, repr.plot.height=10)
ggplot(figvadclinic, aes(x=Phase, fill=Type)) +
geom_bar(width = 0.5) +
coord_polar()+
theme(panel.grid.major = element_blank(), element_text(size=25, face=4L))+
theme_minimal()
解决方案
推荐阅读
- javascript - 使用 express.static() 时如何自动设置 Content-Type?
- node.js - 如何为在 aws EC2 中的 docker 上运行的 node.js 服务器设置 https
- sql - SQL Server:循环遍历每个(PARTITION BY ...)元素的过程或函数
- encryption - 如何仅在给定私钥 d 和 Phi(n) 的情况下解密 RSA2 加密消息 C?
- python - 如何在 Python 中使用 beautifulSoup 在不同的网站上抓取文章
- python - Python键入多重继承作为参数
- android - 滚动时回收器查看初始滞后
- django - 如何在 django 重定向中传递数据?
- java - OSGi Classloader 找不到类 ClassNotFoundException
- html - 在外面绘制正方形包含 CSS