This should be fairly simple, not sure why I can't find the answer.
I have a dataset with 15 variables (columns) from a csv. 2 variables are called Cancer
and copyofCancer
, indicating whether or not someone has cancer. Those 2 columns should become 1 new column where column copyofCancer
is appended to Cancer
.
When combining the 2 columns into 1 new column, I should have the new column added in the complete dataset of 15 variables. I found solutions where I had a dataframe with only 3 variables (Cancer
, copyofCancer
, Cancercombined
) but could not find a way to have this added to my complete dataset of 15 variables. My dataset is called risk
For example
Cancer: yes no yes no
copyofCancer: no no yes no
becomes column:
Cancercombined: yes no yes no no no yes no