Importing a matrix map from a spreadsheet


googleSheets_url <-
  paste0(
    "https://docs.google.com/spreadsheets/d/",
      #"1p8R0M68ZX-G3unLeKnhQ2wZh-tK4o4Ua2BpN4jjJT68"
    "16mpIyMC1ZFiq2kLKW6_cwJKqGIaKTNz2liLJaLehAqw"
  );

matrixMap <-
  comma::matrixMap_fromSpreadsheet(
    googleSheets_url
  );

Converting to a contributors table


comma::contributorsTable_from_matrixMap(
  matrixMap,
  output = tempFileToWrite1
);

Add some contributions


contributorsTable <-
  openxlsx::loadWorkbook(file = tempFileToWrite1);

openxlsx::writeData(
  wb = contributorsTable,
  sheet = "contributor_table",
  startCol = 1,
  startRow = 2,
  x = matrix(c("Person 1", "1", "", "", "1", "", "", "1", rep("", 20), "1",
               "Person 2", "", "1", "1", "", "",  "1", "", rep("", 21)),
             byrow = TRUE,
             nrow = 2),
  colNames = FALSE
);

openxlsx::saveWorkbook(
  wb = contributorsTable,
  file = tempFileToWrite2,
  overwrite = TRUE
);

Import the completed contributors table


contributorsTable_imported <-
  comma::import_contributorsTable(
    tempFileToWrite2
  );

Convert contributions to CRediT


mappedContributions <-
  comma::map_contributions(
    tempFileToWrite2
  );

Show original contributions


knitr::kable(
  contributorsTable_imported$contributor_table
);
Contributor project_group goals synthesis_plans entity_drafting entity_feedback entity_finalization screening_procedure exclusion_criteria search_strategy query_development query_translation preregistration query_execution query_hits_merging search_grey search_author_contact search_validation deduplication screening_packages screening screening_validation screening_processing extraction extraction_validation extraction_processing synthesis_preprocessing synthesis_quality_assessment synthesis synthesis_validation data_management manuscript_first_draft manuscript_review_editing presentation_prepare presentation_present
Person 1 TRUE FALSE FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE
Person 2 FALSE TRUE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE

cat(
  comma::contributionParagraph_from_contributorsTable(
    contributorsTable_imported,
    includeMapping = FALSE
  )
);

Person 1 contributed to Project-group formation, First entity draft, Screening procedure, and to Synthesis analyses. Person 2 contributed to Defining research goals, Synthesis plans, and to Entity finalization.

Show converted contributions


knitr::kable(
  mappedContributions$contributor_table
);
Contributor conceptualization data_curation formal_analysis funding_acquisition investigation methodology project_administration resources software supervision validation visualization writing_original_draft writing_review_editing
Person 1 FALSE FALSE TRUE FALSE FALSE TRUE TRUE FALSE FALSE FALSE FALSE TRUE FALSE FALSE
Person 2 TRUE FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE

cat(
  comma::contributionParagraph_from_contributorsTable(
    mappedContributions,
    includeMapping = FALSE
  )
);

Person 1 contributed to Formal Analysis, Methodology, Project administration, and to Visualization. Person 2 contributed to Conceptualization, Formal Analysis, and to Methodology.

Show both, generic first


cat(
  comma::contributionParagraph_from_contributorsTable(
    contributorsTable_imported
  )
);

Person 1 contributed to Formal Analysis (‘Synthesis analyses’), Methodology (‘First entity draft’ & ‘Screening procedure’), Project administration (‘Project-group formation’), and to Visualization (‘Synthesis analyses’). Person 2 contributed to Conceptualization (‘Defining research goals’), Formal Analysis (‘Synthesis plans’), and to Methodology (‘Entity finalization’).

Show both, specific first


cat(
  comma::contributionParagraph_from_contributorsTable(
    contributorsTable_imported,
    genericIsPrimary = FALSE
  )
);

Person 1 contributed to Project-group formation (‘Project administration’), First entity draft (‘Methodology’), Screening procedure (‘Methodology’), and to Synthesis analyses (‘Formal Analysis’ & ‘Visualization’). Person 2 contributed to Defining research goals (‘Conceptualization’), Synthesis plans (‘Formal Analysis’), and to Entity finalization (‘Methodology’).