Skip to content

Commit db560c4

Browse files
committed
Changes for new dplyr
1 parent 87b9ec6 commit db560c4

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

R/bind_log_odds.R

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ bind_log_odds <- function(tbl, set, feature, n, uninformative = FALSE,
122122

123123
# `.n` is the *actual count* of each word w across
124124
# all groups
125-
feat_counts <- count(pseudo, !!feature, wt = !!n_col)
126-
feat_counts <- rename(feat_counts, .n = n)
125+
feat_counts <- count(pseudo, !!feature, wt = !!n_col, name = ".n")
127126
feat_counts <- left_join(tbl, feat_counts, by = as_name(feature))
128127

129128
pseudo$alpha <- feat_counts$.n
@@ -142,12 +141,10 @@ bind_log_odds <- function(tbl, set, feature, n, uninformative = FALSE,
142141
pseudo <- mutate(pseudo, y_wi = !!n_col + alpha)
143142

144143
# y_w is the total count of word w
145-
feat_counts <- count(pseudo, !!feature, wt = y_wi)
146-
feat_counts <- rename(feat_counts, y_w = n)
144+
feat_counts <- count(pseudo, !!feature, wt = y_wi, name = "y_w")
147145

148146
# n_i is the count of all words in group i
149-
set_counts <- count(pseudo, !!set, wt = y_wi)
150-
set_counts <- rename(set_counts, n_i = n)
147+
set_counts <- count(pseudo, !!set, wt = y_wi, name = "n_i")
151148

152149
# merge the various counts together so we can
153150
# do vectorized operations in a data frame

0 commit comments

Comments
 (0)