Skip to content

Commit

Permalink
coerce data to cj_df in cj()
Browse files Browse the repository at this point in the history
  • Loading branch information
leeper committed Jul 23, 2018
1 parent b652675 commit e3553bd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: cregg
Type: Package
Title: Simple Conjoint Tidying, Analysis, and Visualization
Version: 0.2.3
Date: 2018-07-10
Version: 0.2.4
Date: 2018-07-23
Authors@R: c(person("Thomas J.", "Leeper", role = c("aut", "cre"),
email = "[email protected]",
comment = c(ORCID = "0000-0003-4097-6326")))
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# cregg 0.2.4

* `cj()` now imposes class "cj_df" on `data` to preserve attributes during subsetting.

# cregg 0.2.3

* Added function `cj_table()`, which can be useful in communicating the set of features and levels used in the design as a data frame (e.g,. using `knitr::kable(cj_table(data, ~ feat1 + feat2))`).
Expand Down
3 changes: 3 additions & 0 deletions R/amce_diffs.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ function(
...
) {

# coerce to "cj_df" to preserve attributes
data <- cj_df(data)

# get outcome variable
outcome <- all.vars(stats::update(formula, . ~ 0))

Expand Down
3 changes: 3 additions & 0 deletions R/cj.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ function(
) {
estimate <- match.arg(estimate)

# coerce to "cj_df" to preserve attributes
data <- cj_df(data)

if (!is.null(by)) {
# get RHS variables, variable labels, and factor levels
RHS <- all.vars(stats::update(formula, 0 ~ . ))
Expand Down

0 comments on commit e3553bd

Please sign in to comment.