This is the reverse to groupBy(...).pivot(...).agg(...)
, except for the aggregation, which cannot be reversed.
unpivot(x, ids, values, variableColumnName, valueColumnName)
# S4 method for class 'SparkDataFrame,ANY,ANY,character,character'
unpivot(x, ids, values, variableColumnName, valueColumnName)
# S4 method for class 'SparkDataFrame,ANY,ANY,character,character'
melt(x, ids, values, variableColumnName, valueColumnName)
Arguments
a SparkDataFrame.
a character vector or a list of columns
a character vector, a list of columns or NULL
. If not NULL must not be empty. If NULL
, uses all columns that are not set as ids
.
character Name of the variable column.
character Name of the value column.
unpivot since 3.4.0
melt since 3.4.0
See alsoOther SparkDataFrame functions: SparkDataFrame-class
, agg()
, alias()
, arrange()
, as.data.frame()
, attach,SparkDataFrame-method
, broadcast()
, cache()
, checkpoint()
, coalesce()
, collect()
, colnames()
, coltypes()
, createOrReplaceTempView()
, crossJoin()
, cube()
, dapplyCollect()
, dapply()
, describe()
, dim()
, distinct()
, dropDuplicates()
, dropna()
, drop()
, dtypes()
, exceptAll()
, except()
, explain()
, filter()
, first()
, gapplyCollect()
, gapply()
, getNumPartitions()
, group_by()
, head()
, hint()
, histogram()
, insertInto()
, intersectAll()
, intersect()
, isLocal()
, isStreaming()
, join()
, limit()
, localCheckpoint()
, merge()
, mutate()
, ncol()
, nrow()
, persist()
, printSchema()
, randomSplit()
, rbind()
, rename()
, repartitionByRange()
, repartition()
, rollup()
, sample()
, saveAsTable()
, schema()
, selectExpr()
, select()
, showDF()
, show()
, storageLevel()
, str()
, subset()
, summary()
, take()
, toJSON()
, unionAll()
, unionByName()
, union()
, unpersist()
, withColumn()
, withWatermark()
, with()
, write.df()
, write.jdbc()
, write.json()
, write.orc()
, write.parquet()
, write.stream()
, write.text()
if (FALSE) { # \dontrun{
df <- createDataFrame(data.frame(
id = 1:3, x = c(1, 3, 5), y = c(2, 4, 6), z = c(-1, 0, 1)
))
head(unpivot(df, "id", c("x", "y"), "var", "val"))
head(unpivot(df, "id", NULL, "var", "val"))
} # }
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4