I would like to add a column filled with a character N in a DataFrame in SparkR. I would do it like that with non-SparkR code :
N
df$new_column &l
The straight solution will be to use SparkR::lit() function:
SparkR::lit()
df_new = withColumn(df, "new_column_name", lit("N"))
In newer Spark versions, the following also works:
df1$new_column <- "N" df1[["new_column"]] <- "N"