當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


R SparkR not用法及代碼示例

說明:

布爾表達式的反轉。

布爾表達式的反轉。

用法:

not(x)

## S4 method for signature 'Column'
!x

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

參數:

  • x 要計算的列

細節:

not! 不能直接應用於數值列。要實現 R-like 真實性列必須強製轉換為 BooleanType

注意:

!自 2.3.0 起

不是從 2.3.0 開始

例子:

df <- createDataFrame(data.frame(x = c(-1, 0, 1)))

head(select(df, !column("x") > 0))

 
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"))))

相關用法


注:本文由純淨天空篩選整理自spark.apache.org大神的英文原創作品 !。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。