Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7509141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:49:09+00:00 2026-05-29T22:49:09+00:00

I just discovered R and I am trying to work with it. Here is

  • 0

I just discovered R and I am trying to work with it.

Here is what I am trying to achieve:

I have a vector of numbers, x, between 50 and 100 and with a size of 250 observations.

x = sample(seq(50, 100), 250, repeat = T)

Now, I want to generate another vector of numbers, y, between 0 and 100, which is the same size as vector x such that each element in y is less than or equal to its equivalent in x.

That is to say that if x[1] is 76, for example, the highest value y[1] could attain when generated is 76. But it could definitely be any other value below 76. In other words and more generally, I want vector y to be generated in such a way that y[i] <= x[i].

I hope I have made my request clearer.

Thank you very much!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T22:49:10+00:00Added an answer on May 29, 2026 at 10:49 pm
    y <- x -1 # ...........................
    
     y <- sapply( x, function(x) runif(n=1, max=x))
     y
     [1]  7.2713788 30.0008063 42.5205775  0.9271717 10.7114456 39.5199145  7.4109775
     [8] 28.3464373 28.5840101 34.0654033 15.0675028 50.2836294 45.9031794 13.5931005
    [15] 43.2751738 17.0560824  3.1507491 25.7619129 12.3391448 22.6203684 51.3334810
    [22] 37.0481703 33.4733277 37.1304850 26.7984406 66.3844126 40.2775918 47.6379024
    [29] 16.2480595 66.8358384 33.3513161 60.2673874 65.6204462 45.6951960  1.5729434
    [36] 20.4850357  0.1345737 84.5334203 19.7997451 53.8025623 48.5528486  8.8992123
    [43] 90.9651742 28.3584167 41.7728159 46.4790641 17.8129578 83.1906415 37.5114353
    [50] 89.5685501 85.2499600
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just discovered the what c# knowledge should I have? question and wondered about
I just discovered OmniThreadLibrary & started playing with it. I'm trying to launch, say,
I have a Rails app where users can follow one another. I've just discovered
I'm trying to achieve the ramp effect as seen here: (source: splashdamage.com ) Blending
I just discovered wkhtmltopdf and I'm trying to use it in a perl CGI
I've just discovered idTabs and I'm trying to get a simple one working on
I'm a Java programmer, but not a JavaScript programmer. I have just discovered YUI,
I just discovered the library MarkerManager and I'm trying to use it for my
Just discovered an issue with the sorting plugin used on our cart, was working
I just discovered forge and wanted to try it out at once. I closely

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.