I am using `edgeR package` in `R` and here the code I used


    library(edgeR)
    target <-read.delim("metadata.txt", header=T)
    x <- read.csv('data4.txt', row.names = 1)
    group <- factor(target$group)
    design <- model.matrix(~0+group)

when I print the design variable I would get the following results:

    > design
       group1 group2
    1       1      0
    2       1      0
    3       0      1
    4       1      0
    5       0      1
    6       1      0
    7       1      0
    8       1      0
    9       0      1
    10      0      1
    11      1      0
    12      0      1
    attr(,"assign")
    [1] 1 1
    attr(,"contrasts")
    attr(,"contrasts")$group
    [1] "contr.treatment"

I would like to make a new variable called comparison like this:

    comparison = "group1-group2"

I actually do not know how to do that because group1 and group2 are not headers or separated sections. do you guys know how to that?
Get the dimnames:

    #example data
    group <- factor(1:2)
    design <- model.matrix(~0+group)
    design 
    #   group1 group2
    # 1      1      0
    # 2      0      1
    # attr(,"assign")
    # [1] 1 1
    # attr(,"contrasts")
    # attr(,"contrasts")$group
    # [1] "contr.treatment"
    
    paste(dimnames(design)[[2]], collapse = "-")
    # [1] "group1-group2"

