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

r

Solution

Perhaps also:

(sample.int(101,size=100,replace=TRUE)-1)/100

Problem

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.

Original source