Saturday 30 November 2019

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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...