说明:
按名称删除结构Column
中的字段。
用法:
dropFields(x, ...)
## S4 method for signature 'Column'
dropFields(x, ...)
参数:
x
一列...
要删除的字段的名称。
注意:
从 3.1.0 开始的 dropFields
例子:
df <- select(
createDataFrame(iris),
alias(
struct(
column("Sepal_Width"), column("Sepal_Length"),
alias(
struct(
column("Petal_Width"), column("Petal_Length"),
alias(
column("Petal_Width") * column("Petal_Length"),
"Petal_Product"
)
),
"Petal"
)
),
"dimensions"
)
)
head(withColumn(df, "dimensions", dropFields(df$dimensions, "Petal")))
head(
withColumn(
df, "dimensions",
dropFields(df$dimensions, "Sepal_Width", "Sepal_Length")
)
)
# This method supports dropping multiple nested fields directly e.g.
head(
withColumn(
df, "dimensions",
dropFields(df$dimensions, "Petal.Petal_Width", "Petal.Petal_Length")
)
)
# However, if you are going to add/replace multiple nested fields,
# it is preferred to extract out the nested struct before
# adding/replacing multiple fields e.g.
head(
withColumn(
df, "dimensions",
withField(
column("dimensions"),
"Petal",
dropFields(column("dimensions.Petal"), "Petal_Width", "Petal_Length")
)
)
)
相关用法
- R SparkR dropDuplicates用法及代码示例
- R SparkR drop用法及代码示例
- R SparkR dropTempView用法及代码示例
- R SparkR dropTempTable用法及代码示例
- R SparkR describe用法及代码示例
- R SparkR dapplyCollect用法及代码示例
- R SparkR dapply用法及代码示例
- R SparkR distinct用法及代码示例
- R SparkR dim用法及代码示例
- R SparkR dtypes用法及代码示例
- R matrix转list用法及代码示例
- R SparkR freqItems用法及代码示例
- R SparkR intersectAll用法及代码示例
- R SparkR spark.decisionTree用法及代码示例
- R SparkR sparkR.callJMethod用法及代码示例
- R SparkR sample用法及代码示例
- R SparkR approxQuantile用法及代码示例
- R SparkR glm用法及代码示例
- R SparkR randomSplit用法及代码示例
- R SparkR withColumn用法及代码示例
注:本文由纯净天空筛选整理自spark.apache.org大神的英文原创作品 dropFields。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。