Skip to content

Strange behaviour with ds.Boole when V2 is a negative value #434

Description

@davraam

When we set the argument V2 to a single negative value, the dsBoole doesn't creates the binary variable correctly, even if V2 is within the range of the variable V1. But in addition has a strange behaviour as it overwrites the input variable V1 (this can be a column in the original dataset).

Here is an example using the SURVIVAL.EXPAND_WITH_MISSING data. Example 1 works as expected but example 2 has this strange bahaviour.

ds.summary("D$age.60")

# Example 1: V2 is a positive integer value, within the range of V1
ds.Boole(V1='D$age.60', V2='1', Boolean.operator = "<", 
         numeric.output = TRUE, newobj = "boole_1")
ds.table("boole_1")
ds.summary("D$age.60")

# Example 2: V2 is a negative integer value, within the range of V1
ds.Boole(V1='D$age.60', V2='-5', Boolean.operator = "<", 
         numeric.output = TRUE, newobj = "boole_2")
ds.table("boole_2")
ds.summary("D$age.60")  

All the examples below work fine

# Example 3: V2 is zero, within the range of V1
ds.Boole(V1='D$age.60', V2='0', Boolean.operator = "<", 
numeric.output = TRUE, newobj = "boole_3")
ds.table("boole_3")
ds.summary("D$age.60")

# Example 4: V2 is a positive numeric value, within the range of V1
ds.Boole(V1='D$age.60', V2='7.6', Boolean.operator = "<", 
         numeric.output = TRUE, newobj = "boole_4")
ds.table("boole_4")
ds.summary("D$age.60")

# Example 5: V2 is a positive value, outside the range of V1
ds.Boole(V1='D$age.60', V2='70', Boolean.operator = "<", 
         numeric.output = TRUE, newobj = "boole_5")
ds.table("boole_5")
ds.summary("D$age.60")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions