[R] generate average frame from different data frames

Luigi Marongiu m@rong|u@|u|g| @end|ng |rom gm@||@com
Sat Oct 23 22:15:40 CEST 2021


Hello,
I have a series of classifications of the same data. I saved this
classification in a single dataframe (but it could be a list). X and Y
are the variable and Z is the classification by three raters. `I` is
the individual identifier of each entry:
```
z1 = c(0,0,0,0,0,1,0,0,0,2,
0,1,1,1,0,0,0,1,0,2,
0,1,1,2,0,0,0,1,0,2,
1,1,1,2,1,0,0,1,1,2,
1,0,0,2,1,1,0,1,2,0)
z2 = c(0,0,0,0,0,1,0,0,1,1,
0,1,1,2,0,0,0,1,1,2,
0,0,0,1,0,0,0,1,0,0,
1,2,1,2,1,0,0,1,1,2,
1,0,1,2,1,1,0,1,2,0)
z3 = c(0,0,0,2,0,0,0,0,0,2,
0,1,0,2,0,0,0,1,0,2,
0,1,1,2,0,0,0,1,0,2,
1,1,1,2,1,0,0,2,1,2,
2,0,1,1,1,1,0,1,1,0)
df = data.frame(X=rep(1:5,3), Y=rep(1:5,3), Z=factor(c(z1,z2,z3)), I =1:150)
```
Is there a way to obtain a kind of heath map for each point? Let's say
for the point (x=1,y-1), what was the most common (average)
classification? Is it possible to get the 95% CI of that mean?
Would Two-Dimensional Kernel Density Estimation be the right path?
Thank you



More information about the R-help mailing list