Saturday 26 November 2016

Create a 100 number vector with random values in R rounded to 2 decimals

I need to do a pretty simple task,but since im not versed in R I don't know exactly how to. I have to create a vector of 100 numbers with random values from 0 to 1 with 2 DECIMAL numbers. I've tried this:



 x2 <- runif(100, 0.0, 1.0)



and it works great, but the numbers have 8 decimal numbers and I need them with only 2.

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...