Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export(frollapply)
export(nafill)
export(setnafill)
export(.Last.updated)
export(coalesce)
export(fcoalesce)

S3method("[", data.table)
S3method("[<-", data.table)
Expand Down
8 changes: 4 additions & 4 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,24 +115,24 @@
# 0.357 0.763 0.292 # now
```

18. New function `coalesce(...)` has been written in C, and is multithreaded for `numeric` and `factor`. It replaces missing values according to a prioritized list of candidates (as per SQL COALESCE, `dplyr::coalesce`, and `hutils::coalesce`), [#3424](https://github.com/Rdatatable/data.table/issues/3424). It accepts any number of vectors in several forms. For example, given three vectors `x`, `y`, and `z`, where each `NA` in `x` is to be replaced by the corresponding value in `y` if that is non-NA, else the corresponding value in `z`, the following equivalent forms are all accepted: `coalesce(x,y,z)`, `coalesce(x,list(y,z))`, and `coalesce(list(x,y,z))`.
18. New function `fcoalesce(...)` has been written in C, and is multithreaded for `numeric` and `factor`. It replaces missing values according to a prioritized list of candidates (as per SQL COALESCE, `dplyr::coalesce`, and `hutils::coalesce`), [#3424](https://github.com/Rdatatable/data.table/issues/3424). It accepts any number of vectors in several forms. For example, given three vectors `x`, `y`, and `z`, where each `NA` in `x` is to be replaced by the corresponding value in `y` if that is non-NA, else the corresponding value in `z`, the following equivalent forms are all accepted: `fcoalesce(x,y,z)`, `fcoalesce(x,list(y,z))`, and `fcoalesce(list(x,y,z))`.

```R
# default 4 threads on a laptop with 16GB RAM and 8 logical CPU
N = 100e6
x = replicate(5, {x=sample(N); x[sample(N, N/2)]=NA; x}, simplify=FALSE) # 2GB
y1 = do.call(dplyr::coalesce, x))
y2 = do.call(hutils::coalesce, x))
y3 = do.call(data.table::coalesce, x))
y3 = do.call(data.table::fcoalesce, x))
# user system elapsed (seconds)
# 4.935 1.876 6.810 # dplyr::coalesce
# 3.122 0.831 3.956 # hutils::coalesce
# 0.915 0.099 0.379 # data.table::coalesce
# 0.915 0.099 0.379 # data.table::fcoalesce
identical(y1,y2) && identical(y1,y3)
# TRUE
```

19. Type `complex` is now supported by `setkey`, `setorder`, `:=`, `by=`, `keyby=`, `shift`, `dcast`, `frank`, `rowid`, `rleid`, `CJ`, `coalesce`, `unique`, and `uniqueN`, [#3690](https://github.com/Rdatatable/data.table/issues/3690). Thanks to Gareth Ward and Elio Campitelli for their reports and input. Sorting `complex` is achieved the same way as base R; i.e., first by the real part then by the imaginary part (as if the `complex` column were two separate columns of `double`). There is no plan to support joining/merging on `complex` columns until a user demonstrates a need for that.
19. Type `complex` is now supported by `setkey`, `setorder`, `:=`, `by=`, `keyby=`, `shift`, `dcast`, `frank`, `rowid`, `rleid`, `CJ`, `fcoalesce`, `unique`, and `uniqueN`, [#3690](https://github.com/Rdatatable/data.table/issues/3690). Thanks to Gareth Ward and Elio Campitelli for their reports and input. Sorting `complex` is achieved the same way as base R; i.e., first by the real part then by the imaginary part (as if the `complex` column were two separate columns of `double`). There is no plan to support joining/merging on `complex` columns until a user demonstrates a need for that.

20. `setkey`, `[key]by=` and `on=` in verbose mode (`options(datatable.verbose=TRUE)`) now detect any columns inheriting from `Date` which are stored as 8 byte double, test if any fractions are present, and if not suggest using a 4 byte integer instead (such as `data.table::IDate`) to save space and time, [#1738](https://github.com/Rdatatable/data.table/issues/1738). In future this could be upgraded to `message` or `warning` depending on feedback.

Expand Down
2 changes: 1 addition & 1 deletion R/wrappers.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Very small (e.g. one line) R functions that just call C.
# One file wrappers.R to avoid creating lots of small .R files.

coalesce = function(...) .Call(Ccoalesce, list(...), FALSE)
fcoalesce = function(...) .Call(Ccoalesce, list(...), FALSE)
setcoalesce = function(...) .Call(Ccoalesce, list(...), TRUE)

fifelse = function(test, yes, no, na=NA) .Call(CfifelseR, test, yes, no, na)
Expand Down
150 changes: 75 additions & 75 deletions inst/tests/tests.Rraw
Original file line number Diff line number Diff line change
Expand Up @@ -15147,7 +15147,7 @@ test(2059.3, is.list(L))
test(2059.4, rbindlist(L), data.table(A=1:6, B=7:12))
# does not retain customClass consistent with v1.12.2; for safety as its attributes likely aren't appropriate for the new object

# coalesce, #3424
# fcoalesce, #3424
bool = c(TRUE, NA, FALSE)
bool_val = c(TRUE, TRUE, FALSE)
int = c(1L, 2L, NA_integer_, 4L)
Expand All @@ -15167,102 +15167,102 @@ itime_val = as.ITime(int_val)
posix = as.POSIXct(int, origin="1970-01-01")
posix_val = as.POSIXct(int_val, origin="1970-01-01")
# singleton replacements
test(2060.001, coalesce(bool, TRUE), bool_val)
test(2060.002, coalesce(bool, NA, TRUE), bool_val)
test(2060.003, coalesce(int, 3L), int_val)
test(2060.004, coalesce(int, NA_integer_, 3L), int_val)
test(2060.005, coalesce(num, 3), num_val)
test(2060.006, coalesce(num, NA_real_, 3), num_val)
test(2060.007, coalesce(str, 'b'), str_val)
test(2060.008, coalesce(str, NA_character_, 'b'), str_val)
test(2060.009, coalesce(fkt, factor('b', levels = c('a', 'b'))), fkt_val)
test(2060.010, coalesce(fkt, factor(NA_integer_, levels=c("a","b")), factor('b', levels = c('a', 'b'))), fkt_val)
test(2060.011, coalesce(date, as.Date("1970-01-04")), date_val)
test(2060.012, coalesce(date, as.Date(NA), as.Date("1970-01-04")), date_val)
test(2060.013, coalesce(idate, as.IDate("1970-01-04")), idate_val)
test(2060.014, coalesce(idate, as.IDate(NA), as.IDate("1970-01-04")), idate_val)
test(2060.015, coalesce(itime, as.ITime(3L)), itime_val)
test(2060.016, coalesce(itime, as.ITime(NA), as.ITime(3L)), itime_val)
test(2060.017, coalesce(posix, as.POSIXct(3L, origin="1970-01-01")), posix_val)
test(2060.018, coalesce(posix, as.POSIXct(NA_integer_, origin="1970-01-01"), as.POSIXct(3L, origin="1970-01-01")), posix_val)
test(2060.001, fcoalesce(bool, TRUE), bool_val)
test(2060.002, fcoalesce(bool, NA, TRUE), bool_val)
test(2060.003, fcoalesce(int, 3L), int_val)
test(2060.004, fcoalesce(int, NA_integer_, 3L), int_val)
test(2060.005, fcoalesce(num, 3), num_val)
test(2060.006, fcoalesce(num, NA_real_, 3), num_val)
test(2060.007, fcoalesce(str, 'b'), str_val)
test(2060.008, fcoalesce(str, NA_character_, 'b'), str_val)
test(2060.009, fcoalesce(fkt, factor('b', levels = c('a', 'b'))), fkt_val)
test(2060.010, fcoalesce(fkt, factor(NA_integer_, levels=c("a","b")), factor('b', levels = c('a', 'b'))), fkt_val)
test(2060.011, fcoalesce(date, as.Date("1970-01-04")), date_val)
test(2060.012, fcoalesce(date, as.Date(NA), as.Date("1970-01-04")), date_val)
test(2060.013, fcoalesce(idate, as.IDate("1970-01-04")), idate_val)
test(2060.014, fcoalesce(idate, as.IDate(NA), as.IDate("1970-01-04")), idate_val)
test(2060.015, fcoalesce(itime, as.ITime(3L)), itime_val)
test(2060.016, fcoalesce(itime, as.ITime(NA), as.ITime(3L)), itime_val)
test(2060.017, fcoalesce(posix, as.POSIXct(3L, origin="1970-01-01")), posix_val)
test(2060.018, fcoalesce(posix, as.POSIXct(NA_integer_, origin="1970-01-01"), as.POSIXct(3L, origin="1970-01-01")), posix_val)
# vector replacements
test(2060.051, coalesce(bool, rep(TRUE, 3L)), bool_val)
test(2060.052, coalesce(bool, rep(NA, 3L), rep(TRUE, 3L)), bool_val)
test(2060.053, coalesce(int, rep(3L, 4L)), int_val)
test(2060.054, coalesce(int, rep(NA_integer_, 4L), rep(3L, 4L)), int_val)
test(2060.055, coalesce(num, rep(3, 4L)), num_val)
test(2060.056, coalesce(num, rep(NA_real_, 4L), rep(3, 4L)), num_val)
test(2060.057, coalesce(str, rep('b', 4L)), str_val)
test(2060.058, coalesce(str, rep(NA_character_, 4L), rep('b', 4L)), str_val)
test(2060.059, coalesce(fkt, factor(rep('b', 4L), levels=c('a', 'b'))), fkt_val)
test(2060.060, coalesce(fkt, factor(rep(NA_integer_, 4L), levels=c("a","b")), factor(rep('b', 4L), levels=c('a', 'b'))), fkt_val)
test(2060.061, coalesce(date, rep(as.Date("1970-01-04"), 4L)), date_val)
test(2060.062, coalesce(date, rep(as.Date(NA), 4L), rep(as.Date("1970-01-04"), 4L)), date_val)
test(2060.063, coalesce(idate, rep(as.IDate("1970-01-04"), 4L)), idate_val)
test(2060.064, coalesce(idate, rep(as.IDate(NA), 4L), rep(as.IDate("1970-01-04"), 4L)), idate_val)
test(2060.065, coalesce(itime, rep(as.ITime(3L), 4L)), itime_val)
test(2060.066, coalesce(itime, rep(as.ITime(NA), 4L), rep(as.ITime(3L), 4L)), itime_val)
test(2060.067, coalesce(posix, as.POSIXct(rep(3L, 4L), origin="1970-01-01")), posix_val)
test(2060.068, coalesce(posix, as.POSIXct(rep(NA_integer_, 4L), origin="1970-01-01"), as.POSIXct(rep(3L, 4L), origin="1970-01-01")), posix_val)
test(2060.101, coalesce(bool, list(NA, TRUE)), bool_val)
test(2060.051, fcoalesce(bool, rep(TRUE, 3L)), bool_val)
test(2060.052, fcoalesce(bool, rep(NA, 3L), rep(TRUE, 3L)), bool_val)
test(2060.053, fcoalesce(int, rep(3L, 4L)), int_val)
test(2060.054, fcoalesce(int, rep(NA_integer_, 4L), rep(3L, 4L)), int_val)
test(2060.055, fcoalesce(num, rep(3, 4L)), num_val)
test(2060.056, fcoalesce(num, rep(NA_real_, 4L), rep(3, 4L)), num_val)
test(2060.057, fcoalesce(str, rep('b', 4L)), str_val)
test(2060.058, fcoalesce(str, rep(NA_character_, 4L), rep('b', 4L)), str_val)
test(2060.059, fcoalesce(fkt, factor(rep('b', 4L), levels=c('a', 'b'))), fkt_val)
test(2060.060, fcoalesce(fkt, factor(rep(NA_integer_, 4L), levels=c("a","b")), factor(rep('b', 4L), levels=c('a', 'b'))), fkt_val)
test(2060.061, fcoalesce(date, rep(as.Date("1970-01-04"), 4L)), date_val)
test(2060.062, fcoalesce(date, rep(as.Date(NA), 4L), rep(as.Date("1970-01-04"), 4L)), date_val)
test(2060.063, fcoalesce(idate, rep(as.IDate("1970-01-04"), 4L)), idate_val)
test(2060.064, fcoalesce(idate, rep(as.IDate(NA), 4L), rep(as.IDate("1970-01-04"), 4L)), idate_val)
test(2060.065, fcoalesce(itime, rep(as.ITime(3L), 4L)), itime_val)
test(2060.066, fcoalesce(itime, rep(as.ITime(NA), 4L), rep(as.ITime(3L), 4L)), itime_val)
test(2060.067, fcoalesce(posix, as.POSIXct(rep(3L, 4L), origin="1970-01-01")), posix_val)
test(2060.068, fcoalesce(posix, as.POSIXct(rep(NA_integer_, 4L), origin="1970-01-01"), as.POSIXct(rep(3L, 4L), origin="1970-01-01")), posix_val)
test(2060.101, fcoalesce(bool, list(NA, TRUE)), bool_val)
# floating point extras
x = c(11L, NA, 13L, NA, 15L, NaN, NA, NA, NA)+0.1
y = c(NA, 12L, 5L, NA, NA, 16L, NaN, Inf, NA)+0.1
z = c(11L, NA, 1L, 14L, NA, 16L, 1L, 2L, NA)+0.1
test(2060.151, coalesce(x, y, z), ans<-c(11:15,NaN,NaN,Inf,NA)+0.1)
test(2060.152, coalesce(list(x, y, z)), ans)
test(2060.153, coalesce(x, list(y,z)), ans)
test(2060.154, coalesce(list(x)), x)
test(2060.151, fcoalesce(x, y, z), ans<-c(11:15,NaN,NaN,Inf,NA)+0.1)
test(2060.152, fcoalesce(list(x, y, z)), ans)
test(2060.153, fcoalesce(x, list(y,z)), ans)
test(2060.154, fcoalesce(list(x)), x)
test(2060.155, setcoalesce(list(x)), x)
test(2060.156, setcoalesce(list(x,y,z)), ans)
test(2060.157, x, ans) # setcoalesce updated the first item (x) by reference
# factor of different levels
x = factor(c('a','b',NA,NA,'b'))
y = factor(c('b','b','a',NA,'b'))
z = factor(c('a',NA,NA,'d','a'))
test(2060.180, coalesce(x, y, z), error="Item 3 is a factor but its levels are not identical to the first item's levels")
test(2060.180, fcoalesce(x, y, z), error="Item 3 is a factor but its levels are not identical to the first item's levels")
# edge cases/checks
test(2060.201, coalesce(bool), bool)
test(2060.202, coalesce(fkt), fkt)
test(2060.203, coalesce(bool, 1L), error='Item 2 is type integer but the first item is type logical. Please coerce before coalescing')
test(2060.204, coalesce(bool, NA_integer_), error='Item 2 is type integer but the first item is type logical.')
test(2060.205, coalesce(fkt, 1L), error='Item 1 is a factor but item 2 is not a factor. When factors are involved, all items must be factor')
test(2060.206, coalesce(num, 3L), error='Item 2 is type integer but the first item is type double')
test(2060.207, coalesce(int, 3), error='Item 2 is type double but the first item is type integer')
test(2060.208, coalesce(fkt, 'b'), error='Item 1 is a factor but item 2 is not a factor. When factors are involved, all items must be factor.')
test(2060.209, coalesce(str, factor('b')), error='Item 2 is a factor but item 1 is not a factor. When factors are involved, all items must be factor')
test(2060.212, coalesce(list(1), list(2)), error="The first argument is a list, data.table or data.frame. In this case there should be no other arguments provided.")
test(2060.213, coalesce(bool, c(TRUE, FALSE)), error="Item 2 is length 2 but the first item is length 3. Only singletons are recycled")
test(2060.214, coalesce(as.raw(0), as.raw(1)), error="Unsupported type: raw")
test(2060.215, coalesce(bool, list()), bool)
test(2060.216, coalesce(structure(c(1:2,NA,4L), class=c("a")), c(NA,NA,3L,4L)),, error="Item 2 has a different class than item 1")
test(2060.201, fcoalesce(bool), bool)
test(2060.202, fcoalesce(fkt), fkt)
test(2060.203, fcoalesce(bool, 1L), error='Item 2 is type integer but the first item is type logical. Please coerce before coalescing')
test(2060.204, fcoalesce(bool, NA_integer_), error='Item 2 is type integer but the first item is type logical.')
test(2060.205, fcoalesce(fkt, 1L), error='Item 1 is a factor but item 2 is not a factor. When factors are involved, all items must be factor')
test(2060.206, fcoalesce(num, 3L), error='Item 2 is type integer but the first item is type double')
test(2060.207, fcoalesce(int, 3), error='Item 2 is type double but the first item is type integer')
test(2060.208, fcoalesce(fkt, 'b'), error='Item 1 is a factor but item 2 is not a factor. When factors are involved, all items must be factor.')
test(2060.209, fcoalesce(str, factor('b')), error='Item 2 is a factor but item 1 is not a factor. When factors are involved, all items must be factor')
test(2060.212, fcoalesce(list(1), list(2)), error="The first argument is a list, data.table or data.frame. In this case there should be no other arguments provided.")
test(2060.213, fcoalesce(bool, c(TRUE, FALSE)), error="Item 2 is length 2 but the first item is length 3. Only singletons are recycled")
test(2060.214, fcoalesce(as.raw(0), as.raw(1)), error="Unsupported type: raw")
test(2060.215, fcoalesce(bool, list()), bool)
test(2060.216, fcoalesce(structure(c(1:2,NA,4L), class=c("a")), c(NA,NA,3L,4L)),, error="Item 2 has a different class than item 1")
# different classes of x arg #3660
x = c(11L, NA, 13L, NA, 15L, NA)
y = c(NA, 12L, 5L, NA, NA, NA)
z = c(11L, NA, 1L, 14L, NA, NA)
ans = c(11L,12L,13L,14L,15L,NA_integer_)
test(2060.250, coalesce(list(x, y, z)), ans)
test(2060.251, coalesce(data.frame(x, y, z)), ans)
test(2060.252, coalesce(data.table(x, y, z)), ans)
test(2060.250, fcoalesce(list(x, y, z)), ans)
test(2060.251, fcoalesce(data.frame(x, y, z)), ans)
test(2060.252, fcoalesce(data.table(x, y, z)), ans)
# integer64 tests
if (test_bit64) {
int64 = as.integer64(int)
int64_val = as.integer64(1:4)
test(2060.301, as.character(coalesce(int64, as.integer64(3))), as.character(int64_val)) # why as.character see nanotime tests below
test(2060.302, as.character(coalesce(int64, as.integer64(NA), as.integer64(3))), as.character(int64_val))
test(2060.303, as.character(coalesce(int64, as.integer64(rep(3, 4L)))), as.character(int64_val))
test(2060.304, coalesce(int64, 1), error='Item 2 has a different class than item 1')
test(2060.305, coalesce(int64, 1L), error = 'Item 2 is type integer but the first item is type double')
test(2060.301, as.character(fcoalesce(int64, as.integer64(3))), as.character(int64_val)) # why as.character see nanotime tests below
test(2060.302, as.character(fcoalesce(int64, as.integer64(NA), as.integer64(3))), as.character(int64_val))
test(2060.303, as.character(fcoalesce(int64, as.integer64(rep(3, 4L)))), as.character(int64_val))
test(2060.304, fcoalesce(int64, 1), error='Item 2 has a different class than item 1')
test(2060.305, fcoalesce(int64, 1L), error = 'Item 2 is type integer but the first item is type double')
}
# nanotime tests
if (test_nanotime) {
nt = nanotime(int)
nt_val = nanotime(1:4)
test(2060.401, as.character(coalesce(nt, nanotime(3L))), as.character(nt_val)) # as.character due to eddelbuettel/nanotime#46
test(2060.402, as.character(coalesce(nt, nanotime(NA), nanotime(3L))), as.character(nt_val))
test(2060.403, as.character(coalesce(nt, nanotime(rep(3, 4L)))), as.character(nt_val))
test(2060.404, coalesce(nt, 1), error='Item 2 has a different class than item 1')
test(2060.405, coalesce(nt, 1L), error = 'Item 2 is type integer but the first item is type double')
test(2060.401, as.character(fcoalesce(nt, nanotime(3L))), as.character(nt_val)) # as.character due to eddelbuettel/nanotime#46
test(2060.402, as.character(fcoalesce(nt, nanotime(NA), nanotime(3L))), as.character(nt_val))
test(2060.403, as.character(fcoalesce(nt, nanotime(rep(3, 4L)))), as.character(nt_val))
test(2060.404, fcoalesce(nt, 1), error='Item 2 has a different class than item 1')
test(2060.405, fcoalesce(nt, 1L), error = 'Item 2 is type integer but the first item is type double')
}
# setcoalesce
x = c(11L, NA, 13L, NA, 15L, NA)
Expand All @@ -15279,19 +15279,19 @@ setcoalesce(xx, list())
test(2060.503, xx_addr, address(xx))
test(2060.504, xx, x)
test(2060.505, address(setcoalesce(xx)), xx_addr)
# complex support for coalesce
# complex support for fcoalesce
z1 = c(1i, NA, 1-1i, NA, 0+3i, NA)
z2 = c(NA, 4-2i, 0+0i, NA, NA, NA)
z3 = c(2, NA, 3+6i, 5-1i, NA, NA)
na_idx = c(2L, 4L, 6L)
test(2060.600, coalesce(z1, 0+0i), `[<-`(z1, na_idx, 0+0i))
test(2060.601, coalesce(z1, z2), `[<-`(z1, na_idx, c(4-2i, NA, NA)))
test(2060.602, coalesce(z1, z2, z3), `[<-`(z1, na_idx, c(4-2i, 5-1i, NA)))
test(2060.600, fcoalesce(z1, 0+0i), `[<-`(z1, na_idx, 0+0i))
test(2060.601, fcoalesce(z1, z2), `[<-`(z1, na_idx, c(4-2i, NA, NA)))
test(2060.602, fcoalesce(z1, z2, z3), `[<-`(z1, na_idx, c(4-2i, 5-1i, NA)))
z_addr = address(z1)
setcoalesce(z1, z2, z3)
test(2060.603, address(z1), z_addr)
test(2060.604, z1, `[<-`(z1, na_idx, c(4-2i, 5-1i, NA)))
test(2060.605, coalesce(NULL, "foo"), NULL) # as seen in mlr using BBmisc::coalesce from example(getHyperPars), #3581
test(2060.605, fcoalesce(NULL, "foo"), NULL) # as seen in mlr using BBmisc::coalesce from example(getHyperPars), #3581

# #3650 -- ensure max nrow check on CJ is applied after unique
l = replicate(ceiling(log10(.Machine$integer.max)), rep(1L, 10L), simplify = FALSE)
Expand Down
14 changes: 7 additions & 7 deletions man/coalesce.Rd
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
\name{coalesce}
\alias{coalesce}
\name{fcoalesce}
\alias{fcoalesce}
\alias{setcoalesce}
\title{ Coalescing missing values }
\description{
Fill in missing values in a vector by successively pulling from candidate vectors in order. As per the ANSI SQL function COALESCE, \code{dplyr::coalesce} and \code{hutils::coalesce}.
Fill in missing values in a vector by successively pulling from candidate vectors in order. As per the ANSI SQL function COALESCE, \code{dplyr::coalesce} and \code{hutils::coalesce}. Unlike \code{BBmisc::coalesce} which just returns the first non-NULL vector.
Written in C, and multithreaded for numeric and factor types.
}
\usage{
coalesce(\dots)
fcoalesce(\dots)
}
\arguments{
\item{\dots}{ A set of same-class vectors. These vectors can be supplied as separate arguments or as a single plain list, data.table or data.frame, see examples. }
Expand All @@ -26,9 +26,9 @@ If the first item is \code{NULL}, the result is \code{NULL}.
x = c(11L, NA, 13L, NA, 15L, NA)
y = c(NA, 12L, 5L, NA, NA, NA)
z = c(11L, NA, 1L, 14L, NA, NA)
coalesce(x, y, z)
coalesce(list(x,y,z)) # same
coalesce(x, list(y,z)) # same
fcoalesce(x, y, z)
fcoalesce(list(x,y,z)) # same
fcoalesce(x, list(y,z)) # same
}
\keyword{ data }

2 changes: 1 addition & 1 deletion man/fifelse.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ In contrast to \code{\link[base]{ifelse}} attributes are copied from \code{yes}
A vector of the same length as \code{test} and attributes as \code{yes}. Data values are taken from the values of \code{yes} and \code{no}, eventually \code{na}.
}
\seealso{
\code{\link{coalesce}}
\code{\link{fcoalesce}}
}
\examples{
x = c(1:4, 3:2, 1:4)
Expand Down
Loading