implicit type promotion in fcoalesce and fifelse

Open
#4,101 17 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
r
Domain
data

Research direction

Start by reproducing the reported fcoalesce(NA, 1L, 1.0) and fifelse(TRUE, NA, 1.0) examples and inspect those two entry points. Determine the intended implicit type-promotion rules from the issue and comment discussion, then add coverage showing the agreed behavior. Done means the cases have a decided, tested outcome without breaking existing type checks.

Written by the indexing model from the issue text.

Description

feature request IDate/ITime

Not sure I understand how the fcoalesce function is meant to be used but I found it not very user-friendly.

e.g I have a data.table coming from some computation or database and if one column is full of NA it will be of type Logical and then cant be used directly inside fcoalesce.

> fcoalesce(NA, 1L, 1.0)
Error in fcoalesce(NA, 1L, 1) : 
  Item 2 is type integer but the first item is type logical. Please coerce before coalescing.
> fifelse(TRUE, NA, 1.0)
Error in fifelse(TRUE, NA, 1) : 
  'yes' is of type logical but 'no' is of type double. Please make sure that both arguments have the same type.
Dominant language
R
Stars
3.9k
Forks
1.1k
Avg merge
14h 4m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Rdatatable/data.table

All issues in Rdatatable/data.table

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.