not: not

Description Usage Arguments Details Note See Also Examples

Description

Inversion of boolean expression.

Usage

1
2
3
4
not(x)

## S4 method for signature 'Column'
not(x)

Arguments

x

Column to compute on

Details

not and ! cannot be applied directly to numerical column. To achieve R-like truthiness column has to be casted to BooleanType.

Note

not since 2.3.0

See Also

Other non-aggregate functions: column_nonaggregate_functions, column()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
df <- createDataFrame(data.frame(
  is_true = c(TRUE, FALSE, NA),
  flag = c(1, 0,  1)
))

head(select(df, not(df$is_true)))

# Explicit cast is required when working with numeric column
head(select(df, not(cast(df$flag, "boolean"))))

## End(Not run)

danzafar/tidyspark documentation built on Sept. 30, 2020, 12:19 p.m.