Why are my dataframe column names not working out?

Hi I’m new to the community and happy to be hear.

So I tried making a dataframe and every time the column names came out weird.
Here is the command that I wrote for creating the dataframe:

Blockquote wdf <- data.frame(ST <- murders$state[o], pop <- murders$population[o], killings <- murders$total[o])

“o” is my created index for listing the states with murders from least to greatest.

The observations came out perfectly well, but the column names displayed as:

Blockquote ST…murders.state.o. pop…murders.population.o. killings…murders.total.o.

I’m sorry if my formatting of the question isn’t good.
Thank you for any help on the matter

(A side question: Is there a difference if I use the <- or the = when creating the columns?)

1 Like

I found out that for arguments within the function, one is supposed to place an = sign, not a <- sign. That’s why this messup was happening

2 Likes