Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 在组之间绘制分类数据的公共元素_R_Ggplot2_Bioinformatics - Fatal编程技术网

R 在组之间绘制分类数据的公共元素

R 在组之间绘制分类数据的公共元素,r,ggplot2,bioinformatics,R,Ggplot2,Bioinformatics,我的数据如下所示(实际数据有4000行): 有人能给我推荐一种更好的方法来绘制这类数据吗。我不从事微生物学工作,所以我不知道正确回答您的问题的准确分析水平应该是多少。然而,在我看来,您的数据现在的结构方式不足以回答您的问题。例如,我预计一些真菌和细菌物种在X中会出现不止一次,但X是一个描述特定微生物群落的因子,其中成员级别信息丢失,因为它是在因子级别编码的 然后,我的建议是,将X分为单独的分类群,对于这些分类群,想象它们是在土壤中还是在根际中发现的 new_x <- strsplit(tt

我的数据如下所示(实际数据有4000行):


有人能给我推荐一种更好的方法来绘制这类数据吗。

我不从事微生物学工作,所以我不知道正确回答您的问题的准确分析水平应该是多少。然而,在我看来,您的数据现在的结构方式不足以回答您的问题。例如,我预计一些真菌和细菌物种在
X
中会出现不止一次,但
X
是一个描述特定微生物群落的因子,其中成员级别信息丢失,因为它是在因子级别编码的

然后,我的建议是,将
X
分为单独的分类群,对于这些分类群,想象它们是在土壤中还是在根际中发现的

new_x <- strsplit(tt$X, ";")

# Recombine with original information, you might get a warning about rownames
newdat <- lapply(seq_along(new_x), function(i) {
  cbind(X = new_x[[i]], tt[i,-1])
})
newdat <- do.call(rbind, newdat)

ggplot(newdat, aes(microbiome_type, X, group = X)) +
  geom_point(aes(colour = Type)) +
  geom_line() +
  facet_wrap(~ Reject.null.hypothesis)
new\x
ggplot(tt, aes(microbiome_type, X)) +
  geom_jitter(aes(color = Type), size = 0.9)+
  ggpubr::color_palette("jco")+
  ggpubr::theme_pubclean() +
  theme(axis.text.y=element_blank()) +
  facet_wrap(~Reject.null.hypothesis) 
new_x <- strsplit(tt$X, ";")

# Recombine with original information, you might get a warning about rownames
newdat <- lapply(seq_along(new_x), function(i) {
  cbind(X = new_x[[i]], tt[i,-1])
})
newdat <- do.call(rbind, newdat)

ggplot(newdat, aes(microbiome_type, X, group = X)) +
  geom_point(aes(colour = Type)) +
  geom_line() +
  facet_wrap(~ Reject.null.hypothesis)