Skip to content

Commit

Permalink
do not append if attr already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
stolarczyk committed Mar 16, 2020
1 parent d42c17a commit 2d8299a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions R/project.R
Expand Up @@ -303,9 +303,12 @@ setMethod(
for (iConst in seq_along(constants)) {
# create a one column data.table and glue appand it with to the
# current samples data.table
constantCol = data.table::data.table(rep(constants[[iConst]], colLen))
names(constantCol) = constantsNames[iConst]
.Object@samples = cbind(.Object@samples, constantCol)
if(!constantsNames[iConst] %in% colnames(sampleTable(.Object))) {
constantCol =
data.table::data.table(rep(constants[[iConst]], colLen))
names(constantCol) = constantsNames[iConst]
.Object@samples = cbind(.Object@samples, constantCol)
}
}
}
return(.Object)
Expand Down

0 comments on commit 2d8299a

Please sign in to comment.