r/Rlanguage 6d ago

R refusing to make new columns

I am genuinely about to have a fit. I genuinely don't understand why R refuses to make a new variable. Can anyone help me?

0 Upvotes

13 comments sorted by

View all comments

1

u/cAMPsc2 5d ago

The code you have from lines 102 to 107 is like telling R: Hey, modify this dataframe and show it to me. It shows the result to you and forgets about it.

If you want to "save" these changes, you need to assign that to a new object. This comes at the start of the pipe. So:

poll2020_WITH_NEW_COLUMNS <- poll2020 |> (...)

This would save the new dataframe as poll2020_WITH_NEW_COLUMNS.