After going through the manual I couldn't proceed with collapse replicates

    sampleFiles <- list.files(path = "./", pattern = ".counts")
    sampleNames <- gsub(".counts", "", sampleFiles)
    sampleCondition <- c(rep("KO1", 4),rep("KO2", 4),rep("KO3", 4), rep("WT1", 4),rep("WT2", 4),rep("WT3", 4))
    sampleTable <- data.frame(sampleName = sampleNames, fileName = sampleFiles, condition = sampleCondition)
    ddsHTSeq <- DESeqDataSetFromHTSeqCount(sampleTable = sampleTable,
                                           directory = directory,
                                           design = ~ condition)
    treatments <- c("KO1", "KO2", "KO3", "WT1", "WT2", "WT3")
    library("DESeq2")
    ddsHTSeq <- DESeqDataSetFromHTSeqCount(sampleTable = sampleTable,design = ~ condition)
    colData(ddsHTSeq)$condition <- factor(colData(ddsHTSeq)$condition,
                                          levels = treatments)
    #Analysis using DESeq
    dds <- DESeq(ddsHTSeq)
    resultsNames(dds)
    #Pre-filtering
    dds <- dds[ rowSums(counts(dds)) > 1, ]
    res <- results(dds)
    #summarise some basic tallies
    summary(res)

**This was the example from  collapseReplicates, I am not sure where should I apply this step and how should I proceed with my dataset**

    dds <- makeExampleDESeqDataSet(m=12)
    
    # make data with two technical replicates for three samples
    dds$sample <- factor(sample(paste0("sample",rep(1:9, c(2,1,1,2,1,1,2,1,1)))))
    dds$run <- paste0("run",1:12)
    
    ddsColl <- collapseReplicates(dds, dds$sample, dds$run)
    
    # examine the colData and column names of the collapsed data
    colData(ddsColl)
    colnames(ddsColl)
    
    # check that the sum of the counts for "sample1" is the same
    # as the counts in the "sample1" column in ddsColl
    matchFirstLevel <- dds$sample == levels(dds$sample)[1]
    stopifnot(all(rowSums(counts(dds[,matchFirstLevel])) == counts(ddsColl[,1])))
In order to use `collapseReplicates`, you need a colData like this :

             condition   sample         run
    1          KO      KO1        AdipoKO1a
    2          KO      KO1        AdipoKO1b
    3          KO      KO1        AdipoKO1c
    4          KO      KO1        AdipoKO12
    5          KO      KO2        AdipoKO2a
    6          KO      KO2        AdipoKO2b
    ...

Then you will collapse your "runs" (technical replicates) at the level of your samples (biological replicates) :

    ddsColl <- collapseReplicates(ddsHTSeq, ddsHTSeq$sample, ddsHTSeq$run)