Skip to content

Commit

Permalink
patch to fix #27 , bump to v0.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jhelvy committed Aug 9, 2023
1 parent 82d5d50 commit 449ed0a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: cbcTools
Title: Choice-Based Conjoint Experiment Design Generation and Power Evaluation in R
Version: 0.5.0
Version: 0.5.1
Maintainer: John Helveston <[email protected]>
Authors@R: c(
person(given = "John",
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# cbcTools (development version)

# cbcTools 0.5.1

- Patch to fix a joining issue in the `join_profiles()` function (#27)

# cbcTools 0.5.0

- Further revisions to the `method` argument in the `cbc_design()` function.
Expand Down
6 changes: 6 additions & 0 deletions R/design.R
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ get_type_ids <- function(profiles) {

join_profiles <- function(design, profiles) {

# Preserve row order

design$row_order <- seq(nrow(design))

# Before joining profiles, ensure that all the data types are the same
# as in profiles, otherwise join won't work properly

Expand All @@ -330,6 +334,8 @@ join_profiles <- function(design, profiles) {
# Join on profileIDs, then reorder to retain design order
varnames <- names(profiles[, 2:ncol(profiles)])
design <- merge(design, profiles, by = varnames, all.x = TRUE, sort = FALSE)
design <- design[order(design$row_order),]
design$row_order <- NULL
if ('blockID' %in% names(design)) { varnames <- c(varnames, 'blockID') }
design <- design[c('profileID', varnames)]
return(design)
Expand Down

0 comments on commit 449ed0a

Please sign in to comment.