Skip to contents

Create a contributors table from a comma matrix map specification

Usage

contributorTable_from_CoMMaSpec(
  CoMMaSpec,
  output = NULL,
  contributors = c("Example name 1", "Example name 2"),
  nContrib = 10,
  type = "simple",
  embed_CoMMaSpec = TRUE
)

Arguments

CoMMaSpec

The comma contributor Matrix Map specification

output

Either NULL to not write anything, or the path to a spreadsheet to write to.

contributors

Optionally, a vector (or in the future, list) of contributors to prefill the contributors table with.

nContrib

Number of rows for contributors to include

type

The type of contributor table to write; currently, only a simple type is supported.

embed_CoMMaSpec

Whether to embed the Comma Specification itself.

Value

The contributors table as data frame

Examples

### First we load an included CoMMa spec repo

### Get included repo location
repoPath <-
  system.file(
    "CoMMa-spec-repo",
    "CoMMa-specs.yml",
    package = "comma"
  );

### Import repo
importedRepo <-
  comma::import_comma_repo(
    repoPath
  );

### Then we get one CoMMa spec
example_CoMMa_spec <-
  importedRepo$CoMMa_specs[[
    "comma-spec-general-systematic-review"
  ]];

### Then we produce the contribution table
contribTable <-
  comma::contributorTable_from_CoMMaSpec(
    example_CoMMa_spec
  );

### View a small part
contribTable$contributor_table[1:3, 1:4];
#>      Contributor Project-group formation Defining research goals
#> 1 Example name 1                                                
#> 2 Example name 2                                                
#> 3                                                               
#>   Synthesis plans
#> 1                
#> 2                
#> 3                

### Set some values
contribTable$contributor_table[1, 2] <- 1;
contribTable$contributor_table[2, 2] <- "Yes";
contribTable$contributor_table[1, 3] <- TRUE;
contribTable$contributor_table[2, 4] <- "X";

### Check this
contribTable$contributor_table[1:3, 1:4];
#>      Contributor Project-group formation Defining research goals
#> 1 Example name 1                       1                    TRUE
#> 2 Example name 2                     Yes                        
#> 3                                                               
#>   Synthesis plans
#> 1                
#> 2               X
#> 3                

### Show contribution paragraph
contributionParagraph_from_contributorTable(
  contribTable
);
#> [1] "**Example name 1** contributed to Conceptualization ('Defining research goals', 'Exclusion criteria' & 'Query development'), and to Project administration ('Project-group formation', 'Preregistration', 'Communicating with authors', 'Prepare a presentation' & 'Give a presentation'). **Example name 2** contributed to Formal Analysis ('Synthesis plans' & 'Synthesis analyses'), and to Project administration ('Project-group formation', 'Preregistration', 'Communicating with authors', 'Prepare a presentation' & 'Give a presentation')."