Convert CBMs to Standard

The CHOIR Body Map does not use the same numbering scheme for male and female body maps (as of August 2021).

# mislabeled_cbm_img <- function() {
#   # magick::image_read(system.file("img/mislabeled-bodymaps.png", "CHOIRBM"))
#   filename <- "img/mislabeled-bodymaps.png"
#   system.file(filename, package = "CHOIRBM", lib.loc = .libPaths()[1])
# }
# knitr::include_graphics("inst/img/mislabeled-bodymaps.png")

Therefore, for mixed gender analysis (such as examining differences in segment endorsements between men and women), it is necessary to convert maps to the same standard. This vignette demonstrates how to re-number the female body map to the male numbering scheme.

library(CHOIRBM)
## basic example code
# generate example data <- don't do this if you have data already, load it 
# into R with read.csv, read.delim, etc.
GENDER = as.character(c("Male", "Female", "Female"))
BODYMAP_CSV = as.character(c("112,125","112,113","128,117"))
cbind(GENDER, BODYMAP_CSV)
#>      GENDER   BODYMAP_CSV
#> [1,] "Male"   "112,125"  
#> [2,] "Female" "112,113"  
#> [3,] "Female" "128,117"

# convert the female bodymaps to a standard
BODYMAP_CSV[GENDER == "Female"] <- convert_bodymaps(
  BODYMAP_CSV[GENDER == "Female"]
  )
sampledata <- data.frame(GENDER, BODYMAP_CSV)
sampledata
#>   GENDER BODYMAP_CSV
#> 1   Male     112,125
#> 2 Female     116,117
#> 3 Female     128,115

To save your fixed data, run:

write.csv(sampledata, "filepath/filename.csv")