Integer number decimal

Hi, I have a problem and I do not know how to solve it.
I have a .csv file and the column of the variable "age" (integer) one number is 60667 but should be 60.667. I tried to change directly from the file I cannot either. I see the format and seems to be "ok", it is a number, this is the code #.##0,00. I even try to copy the format from another cell that it is ok, but nothing works.

I tried thinks like this "heart_failure$age<-sapply(heart_failure$age, function(x) as.numeric(gsub(",", ".", x)))" but it is impossible, I do not know if someone could help me to do this with Rstudio, thanks a lot!

Looking at a csv file with a in a spreadsheet can be deceiving because of the cell formatting. Use a simple text editor to see the content of the csv.

It seems you are trying to add a thousands separator to the number. That will, as far as I know, change the number into text. Is that what you want? That should only be done for purposes of display after all of the calculations are complete.

This topic was automatically closed 21 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.