Skip to content

Commit 935ac60

Browse files
committed
fix typo
1 parent 839463e commit 935ac60

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

R/bmerge.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,20 @@ bmerge = function(i, x, icols, xcols, roll, rollends, nomatch, mult, ops, verbos
102102
if (i_merge_type=="double") {
103103
coerce_x = FALSE
104104
if (!isReallyReal(i[[ic]])) {
105+
coerce_x = TRUE
105106
# common case of ad hoc user-typed integers missing L postfix joining to correct integer keys
106107
# we've always coerced to int and returned int, for convenience.
107108
if (length(ic_idx)>1L) {
108109
xc_idx = xcols[ic_idx]
109110
for (b in which(vapply_1c(x[0L, ..xc_idx], getClass) == "double")) {
110111
xb = xcols[b]
111-
if (isReallyReal(x[[xb]])) {
112-
coerce_x = TRUE
112+
if (!isReallyReal(x[[xb]])) {
113+
coerce_x = FALSE
113114
break
114115
}
115116
}
116117
}
117-
if (!coerce_x) {
118+
if (coerce_x) {
118119
if (verbose) catf("Coercing double column %s (which contains no fractions) to type integer to match type of %s.\n", iname, xname)
119120
val = as.integer(i[[ic]])
120121
if (!is.null(attributes(i[[ic]]))) attributes(val) = attributes(i[[ic]]) # to retain Date for example; 3679
@@ -132,8 +133,7 @@ bmerge = function(i, x, icols, xcols, roll, rollends, nomatch, mult, ops, verbos
132133
}
133134
}
134135
}
135-
if (coerce_x) {
136-
ic_idx = which()
136+
if (!coerce_x) {
137137
if (verbose) catf("Coercing integer column %s to type double to match type of %s which contains fractions.\n", xname, iname)
138138
set(x, j=xc, value=as.double(x[[xc]]))
139139
}

0 commit comments

Comments
 (0)