To create a new column in data :
library("titanic")
traint <- titanic_train
I use :
traint["newCol"] <- traint['Survived'] == 1
or
traint$newCol <- traint['Survived'] == 1
The newly created column added to traint
data appear equivalent.
Which method should I choose when creating a new column within data ? ["newColName"]
or $newColName
? Are both methods of creating the new column equivalent ?