Character to numeric and format numeric

Hi again. I'm triying to convert a character column to numeric. Easy? Sure, df$character` <- as.numeric(df$character). But I want also format the number (in character column the format is 11223 and I want 11.223 where the dot is thousand separator not decimal). I'm sure it's simple but I am stuck

Thx

Unfortunately, I don't believe you can have both. If you include commas in your column, then the numbers will be converted back into characters. However, here's the code to include commas in your column.

format(as.numeric(df$character),big.mark=",")

Hope this helps!

1 Like

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.