dtypesΒΆ

dtypes returns a list of all column names of a SparkDataFrame and their respective data types.

Syntax:

  • dtypes(SparkDataFrame)

Parameters:

  • SparkDataFrame: Any SparkDataFrame

Output:

  • List
require(SparkR)

# Create SparkDataFrame using the faithful dataset from R
df <- createDataFrame(iris)

# Displays the content of the SparkDataFrame to stdout
head(df)
# View column names with their respective data types
dtypes(df)