Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in R Programming by (50.2k points)

I have a column of numeric values, say for instance:

v <- c(12345, 2345, 7689900)

The actual form of values is 12.345, 23.45, 76.89900, ie every numeric has two digits and the rest is decimals.

How can I convert the vector to this format? No decimal should be cropped in the process.

1 Answer

0 votes
by (108k points)

I think you are looking for a numeric vector:

v/10^(nchar(v) - 2)

[1] 12.345 23.450 76.899

If you are a beginner and want to know more about R then do check out the R programming tutorial

Browse Categories

...