R Generate Random Numbers with floor and runif

0 votes
The R programming language is what I'm utilising. I'm attempting to produce random integers in the range between 1 and 0. I tried the following code to produce 1000 random integers between 0 and 1 using the website at the following address: http://www.cookbook-r.com/Numbers/Generating random numbers/.

Runif(1000, min=0, max=1), x = floor
Runif(1000, min=0, max=1), y = floor
sample(LETTERS[1:2], 1000, replace=TRUE, prob=c(0.8,0.2))

the data frame d (x,y,group)
as.factor(d$group) = d$group
But it appears that "x" and "y" only have a value of 0.

Can somebody tell me what I'm doing incorrectly? Thanks
Jul 22 in Data Science by avinash
• 1,840 points
12 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Data Science

0 votes
0 answers

Introduction to Statistical Learning with Applications in R Figure Codes

I recently bought the following book: An Introduction ...READ MORE

Jun 1 in Data Science by avinash
• 1,840 points
33 views
0 votes
1 answer

Difference between the == and %in% operators in R

percent in percent "returns a vector of ...READ MORE

answered Jun 20 in Data Science by Sohail
• 2,960 points
21 views
0 votes
1 answer

Difference between the == and %in% operators in R

According to help('percent in percent'), percent in ...READ MORE

answered Jun 23 in Data Science by Sohail
• 2,960 points
15 views
0 votes
1 answer

R cbind with get paste

This is how we use column names x ...READ MORE

answered Jun 1 in Data Science by Sohail
• 2,960 points
30 views
0 votes
1 answer

Creating new Functions with Linear Regression in R :

When we want to create a model ...READ MORE

answered Jun 1 in Data Science by Sohail
• 2,960 points
30 views
0 votes
1 answer

Why is it not advisable to use attach() in R, and what should I use instead?

There is one more option that applies ...READ MORE

answered Jun 24 in Data Science by Sohail
• 2,960 points
18 views
0 votes
1 answer

Big Data transformations with R

Dear Koushik, Hope you are doing great. You can ...READ MORE

answered Dec 18, 2017 in Data Analytics by Sudhir
• 1,610 points
437 views
0 votes
2 answers

Transforming a key/value string into distinct rows in R

We would start off by loading the ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
480 views
0 votes
1 answer

Finding frequency of observations in R

You can use the "dplyr" package to ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
4,351 views
0 votes
1 answer

Left Join and Right Join using "dplyr"

The below is the code to perform ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,660 points
503 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP