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

PHOTO EMBED

Tue Dec 27 2022 02:20:44 GMT+0000 (Coordinated Universal Time)

Saved by @Mostafa_malmir

# Add multiple columns to dataframe
chapters = c(76,86)
price=c(144,553)
df3 <- cbind(df, chapters, price)

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

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