I have a csv file, saved via Excel (using the ";" as a column separator). When I import it into R, the numbers that are in the 0.00 format are factored and comma.
Ex: "123,45"
When you do the conversion, it stays as text.
num <- gsub("," , "." , "123,45")
num="123.45"
When I convert them individually they see number.
num <- as.numeric(num)
num = 123.45
But when I do this in a vector, the numbers are rounded.
numeros <- gsub(",",".",numeros)
numeros <- as.numeric(numeros)
numbers = 123 457 ...
Even using a loop, the same thing happens.
for (i in 1:lenght(numeros)) {
numeros[i] <- as.numeric(numeros[i]
}
numbers = 123 457 ...
I would like to know how numbers with commas in numbers in the pattern of R.