Plotting a single patient’s CBM

Eric Cramer

This vignette describes the process of converting a string representation of a CHOIR Body Map (CBM) into a plot.

CBM data for a given patient is often provided in a delimited string similar to this: “101,102,103,104” (these segment identifiers indicate the face and top of the head). If you want to plot the CBM of a single patient (e.g., for a report) or highlight specific segments on a CBM (e.g., in a paper), then you can use the string_to_map function to convert this string into an R data.frame object ready for the rest of the plotting functions in CHOIRBM. Let’s take the above string as an example.

Converting a string map into a CBM-plot-ready data frame

Start with the string representation of a patient’s CBM. When it is converted to a data frame, the CBM is represented as a series of segment IDs with a group label (indicating if the segment belongs to the front or back of the body map) and a binary value to indicate whether the segment was present in this patient’s CBM string.


cbm_str <- "101,102,103,104"
cbm_df <- string_to_map(cbm_str)
#>    id group value
#> 1 101 Front     1
#> 2 102 Front     1
#> 3 103 Front     1
#> 4 104 Front     1
#> 5 105 Front     0
#> 6 106 Front     0

The resulting data frame is plot-able:

plot_male_choirbm(cbm_df, "value")