Layout data visualization

I have a dataset like that:

pos <- c("A1", "A2", "A3", "A4", "B1", "B2", "B3", "B4", "C1", "C2")
acc <- c(23,21, 31, 10, 12, 25, 45, 12, 15, 9)
error <- c(2,1, 3, 1, 0, 0, 4, 1, 5, 0)


y <- cbind(pos, acc, error)
y <- as.data.frame(y)

and the column "pos" is referred to the following layout:
image

The column "acc" are the total access to the position and "error" is the error done in the position. Is there a way to visualized the layout with the % of error? (% = error/acc)

Calculating the error is simple:

library(tidyverse)

y <- y %>% 
  as_tibble() %>% 
  type_convert() %>% 
  mutate(`%` = error/acc)

Graphically recreating the example you have shown could be more complex, but heat map could works

Yes, heat map is a good idea. How can I reproduce my layout?

The layout can be regarded as a table with 5 rows and 4 cols.

Code below for the first two columns:

library(dplyr)
library(gt)
percent <- tibble(col1 = c(2/23, 1/21, 3/31, 1/10, ""), 
                  col2 = c(rep("", 4), 5/15))
percent %>% 
    gt() %>% 
    tab_options(column_labels.hidden = TRUE)

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.