English 中文(简体)
如何利用聚合物2R对多种变数和亚类进行精确度分数的划分?
原标题:How to plot Bar_Chart of accuracy scores as percentage value for multiple variables and subgroups using ggplot2 R?

我感谢你考虑帮助我这样做。

对于重复措施的7个部分,我有关于准确性(0和1)和反应时间(无)的原始数据点。 这些数据按长格式编排(用于管理全球升温潜能值),有多个分组: (1) 每个组中有两个组:DD和TD,两个组: 年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄、年龄

我要以不同的彩色标示七个区块(X-轴)的准确分数,这两个组分别为DD和TD。 我想绘制四幅图表: (1) 年龄在Range-I 2)年龄在Range-I 3级的SOC和年龄在Range-II级的MOC,两个年龄段的每个任务状况的每个区块中的DD和TD的差异可以直观。

我很想知道如何开始图表。 我需要帮助计算每个分组的百分比分数,然后将分数分为四个图表。 我学会使用大鼠,因此,我谨请你帮助引导我一步步。

例如,下文是我的抽样数据框架,每个参与者对每一序列类型(SOC和MOC)有420份答复,每组有60份答复。

    Acc        RT SeqType Group Age Gender    Block AgeRange
1     1 0.7251608     MOC    TD  12      M    rand1       II
2     1 0.4612991     MOC    TD  12      M    rand1       II
3     1 0.4952396     MOC    TD  12      M    rand1       II
4     1 0.6954593     MOC    TD  12      M    rand1       II
5     1 0.6724732     MOC    TD  12      M    rand1       II
6     1 0.5995035     MOC    TD  12      M    rand1       II
7     1 0.4580509     MOC    TD  12      M    rand1       II
8     1 0.6537255     MOC    TD  12      M    rand1       II
9     1 0.5203535     MOC    TD  12      M    rand1       II
10    1 0.4601149     MOC    TD  12      M    rand1       II
11    1 0.6116865     MOC    TD  12      M    rand1       II
12    1 0.5768449     MOC    TD  12      M    rand1       II
13    1 0.4669667     MOC    TD  12      M    rand1       II
14    1 0.6111208     MOC    TD  12      M    rand1       II
15    1 0.5442212     MOC    TD  12      M    rand1       II
16    1 0.4883995     MOC    TD  12      M    rand1       II
17    1 0.3736103     MOC    TD  12      M    rand1       II
18    1 0.4266320     MOC    TD  12      M    rand1       II
19    1 0.5183420     MOC    TD  12      M    rand1       II
20    1 0.5546551     MOC    TD  12      M    rand1       II
21    1 0.5560170     MOC    TD  12      M    rand1       II
22    1 0.5006457     MOC    TD  12      M    rand1       II
23    1 0.7199959     MOC    TD  12      M    rand1       II
24    1 0.4653944     MOC    TD  12      M    rand1       II
25    1 0.3975185     MOC    TD  12      M    rand1       II
26    1 0.5103894     MOC    TD  12      M    rand1       II
27    1 0.5528382     MOC    TD  12      M    rand1       II
28    1 0.4942312     MOC    TD  12      M    rand1       II
29    0 0.3204265     MOC    TD  12      M    rand1       II
30    1 0.9355211     MOC    TD  12      M    rand1       II
31    1 0.4102691     MOC    TD  12      M    rand1       II
32    1 0.6568323     MOC    TD  12      M    rand1       II
33    1 0.4086500     MOC    TD  12      M    rand1       II
34    1 0.3624091     MOC    TD  12      M    rand1       II
35    1 1.0586907     MOC    TD  12      M    rand1       II
36    1 0.9566940     MOC    TD  12      M    rand1       II
37    1 0.5252956     MOC    TD  12      M    rand1       II
38    1 0.4546399     MOC    TD  12      M    rand1       II
39    1 0.7973861     MOC    TD  12      M    rand1       II
40    1 0.7637680     MOC    TD  12      M    rand1       II
41    1 0.5488241     MOC    TD  12      M    rand1       II
42    1 0.5988611     MOC    TD  12      M    rand1       II
43    1 0.3962510     MOC    TD  12      M    rand1       II
44    1 0.8010187     MOC    TD  12      M    rand1       II
45    1 0.4379103     MOC    TD  12      M    rand1       II
46    1 0.6626628     MOC    TD  12      M    rand1       II
47    1 0.6684044     MOC    TD  12      M    rand1       II
48    1 0.4509241     MOC    TD  12      M    rand1       II
49    1 0.5236573     MOC    TD  12      M    rand1       II
50    1 0.7692868     MOC    TD  12      M    rand1       II
51    1 0.5507855     MOC    TD  12      M    rand1       II
52    0 0.4933297     MOC    TD  12      M    rand1       II
53    0 0.1103503     MOC    TD  12      M    rand1       II
54    1 1.2388133     MOC    TD  12      M    rand1       II
55    1 0.4912523     MOC    TD  12      M    rand1       II
56    1 0.4215691     MOC    TD  12      M    rand1       II
57    1 0.6643740     MOC    TD  12      M    rand1       II
58    1 0.6219135     MOC    TD  12      M    rand1       II
59    1 0.5624236     MOC    TD  12      M    rand1       II
60    1 0.6500025     MOC    TD  12      M    rand1       II
61    1 0.7855459     MOC    TD  12      M pattern1       II
62    1 1.1856054     MOC    TD  12      M pattern1       II
63    1 0.6736443     MOC    TD  12      M pattern1       II
64    1 0.3531554     MOC    TD  12      M pattern1       II
65    1 0.4241763     MOC    TD  12      M pattern1       II
66    1 0.5550015     MOC    TD  12      M pattern1       II
67    1 0.5050880     MOC    TD  12      M pattern1       II
68    1 0.8703709     MOC    TD  12      M pattern1       II
69    1 0.6194714     MOC    TD  12      M pattern1       II
70    1 0.5241663     MOC    TD  12      M pattern1       II
71    1 0.5712235     MOC    TD  12      M pattern1       II
72    1 0.5549760     MOC    TD  12      M pattern1       II
73    1 0.5461535     MOC    TD  12      M pattern1       II
74    1 0.4590558     MOC    TD  12      M pattern1       II
75    1 0.5930836     MOC    TD  12      M pattern1       II
76    1 0.3251405     MOC    TD  12      M pattern1       II
77    1 0.4547834     MOC    TD  12      M pattern1       II
78    1 0.6656017     MOC    TD  12      M pattern1       II
79    1 0.5747337     MOC    TD  12      M pattern1       II
80    1 0.6185604     MOC    TD  12      M pattern1       II
81    1 0.4145572     MOC    TD  12      M pattern1       II
82    1 0.6745456     MOC    TD  12      M pattern1       II
83    1 0.7746098     MOC    TD  12      M pattern1       II
84    1 0.5133774     MOC    TD  12      M pattern1       II
85    1 0.5258784     MOC    TD  12      M pattern1       II
86    1 0.4565186     MOC    TD  12      M pattern1       II
87    1 0.5889995     MOC    TD  12      M pattern1       II
88    1 0.3449315     MOC    TD  12      M pattern1       II
89    1 0.5819102     MOC    TD  12      M pattern1       II
90    1 0.8865610     MOC    TD  12      M pattern1       II
91    1 0.5959914     MOC    TD  12      M pattern1       II
92    1 0.9679550     MOC    TD  12      M pattern1       II
93    1 0.5613606     MOC    TD  12      M pattern1       II
94    1 0.4631545     MOC    TD  12      M pattern1       II
95    1 0.7547015     MOC    TD  12      M pattern1       II
96    1 0.6207818     MOC    TD  12      M pattern1       II
97    1 0.6984035     MOC    TD  12      M pattern1       II
98    1 0.5729400     MOC    TD  12      M pattern1       II
99    1 0.4809960     MOC    TD  12      M pattern1       II
100   1 0.4761289     MOC    TD  12      M pattern1       II
101   1 0.4188091     MOC    TD  12      M pattern1       II
102   1 1.5040006     MOC    TD  12      M pattern1       II
103   1 0.6312318     MOC    TD  12      M pattern1       II
104   1 0.6400253     MOC    TD  12      M pattern1       II
105   0 0.7697745     MOC    TD  12      M pattern1       II
106   1 0.7604482     MOC    TD  12      M pattern1       II
107   1 0.7815664     MOC    TD  12      M pattern1       II
108   1 0.7523210     MOC    TD  12      M pattern1       II
109   1 0.9477502     MOC    TD  12      M pattern1       II
110   1 0.8546340     MOC    TD  12      M pattern1       II
111   1 0.5928595     MOC    TD  12      M pattern1       II
112   1 0.5591475     MOC    TD  12      M pattern1       II
113   1 1.6878362     MOC    TD  12      M pattern1       II
114   1 0.7820587     MOC    TD  12      M pattern1       II
115   1 0.6034753     MOC    TD  12      M pattern1       II
116   1 0.7221258     MOC    TD  12      M pattern1       II
117   1 0.9977003     MOC    TD  12      M pattern1       II
118   1 0.6633138     MOC    TD  12      M pattern1       II
119   1 0.6683258     MOC    TD  12      M pattern1       II
120   1 0.8003613     MOC    TD  12      M pattern1       II
121   1 0.7728075     MOC    TD  12      M pattern2       II
122   1 0.4008616     MOC    TD  12      M pattern2       II
123   1 0.5187239     MOC    TD  12      M pattern2       II
124   1 0.4192724     MOC    TD  12      M pattern2       II
125   1 0.4695848     MOC    TD  12      M pattern2       II 

基本上,这是SOC-AgeRange-1的图表;这是我想要通过使用r.ggplot2实现的图表。

“entergraph

问题回答

你没有给我们足够的数据来绘制一份具有理想结构的地图,但你的描述足以让一个具有相同结构的可再生例子(见下文)。 基本上,这很正确,因为你想要一栏显示准确度(轴心)和轴心,以及按组别填写和篡改的栏目,然后由年龄组和按属性类型分别处理。 这部法典就是:

library(ggplot2)

ggplot(data, aes(Block, Acc, fill = Group)) +
  stat_summary(fun = mean, geom = "col", position = "dodge") +
  facet_wrap(. ~ paste("Age Range:", AgeRange) + 
                 paste("Sequence Type:", SeqType)) +
  scale_fill_brewer(palette = "Set1") +
  theme_minimal(base_size = 16)

“在此处的影像描述”/</a

Created on 2023-08-12 with reprex v2.0.2





相关问题
How to plot fitted model over observed time series

This is a really really simple question to which I seem to be entirely unable to get a solution. I would like to do a scatter plot of an observed time series in R, and over this I want to plot the ...

REvolution for R

since the latest Ubuntu release (karmic koala), I noticed that the internal R package advertises on start-up the REvolution package. It seems to be a library collection for high-performance matrix ...

R - capturing elements of R output into text files

I am trying to run an analysis by invoking R through the command line as follows: R --no-save < SampleProgram.R > SampleProgram.opt For example, consider the simple R program below: mydata =...

R statistical package: wrapping GOFrame objects

I m trying to generate GOFrame objects to generate a gene ontology mapping in R for unsupported organisms (see http://www.bioconductor.org/packages/release/bioc/vignettes/GOstats/inst/doc/...

Changing the order of dodged bars in ggplot2 barplot

I have a dataframe df.all and I m plotting it in a bar plot with ggplot2 using the code below. I d like to make it so that the order of the dodged bars is flipped. That is, so that the bars labeled "...

Strange error when using sparse matrices and glmnet

I m getting a weird error when training a glmnet regression. invalid class "dgCMatrix" object: length(Dimnames[[2]]) must match Dim[2] It only happens occasionally, and perhaps only under larger ...

Generating non-duplicate combination pairs in R

Sorry for the non-descriptive title but I don t know whether there s a word for what I m trying to achieve. Let s assume that I have a list of names of different classes like c( 1 , 2 , 3 , 4 ) ...

Per panel smoothing in ggplot2

I m plotting a group of curves, using facet in ggplot2. I d like to have a smoother applied to plots where there are enough points to smooth, but not on plots with very few points. In particular I d ...

热门标签