Add Column to DataFrame in R - Spark by {Examples}

PHOTO EMBED

Tue Dec 27 2022 02:21:34 GMT+0000 (Coordinated Universal Time)

Saved by @Mostafa_malmir

# Using $ notation
chapters = c(76,86)
df$chapters <- chapters
df

# Output
#  id pages   name chapters
#1 11    32  spark       76
#2 22    45 python       86
content_copyCOPY

https://sparkbyexamples.com/r-programming/add-column-to-dataframe-in-r/