Imagine you need to create a vector in R containing the first 100 positive integers. How would you do this?

  • Use the : operator to create a sequence from 1 to 100
  • Use the seq() function with the from and to arguments
  • Use the rep() function to repeat the number 1, 100 times
  • Use the sample() function to randomly select numbers from 1 to 100
To create a vector in R containing the first 100 positive integers, you can use the : operator to create a sequence from 1 to 100. The : operator generates a sequence of consecutive integers between two given endpoints. In this case, it will create a sequence from 1 to 100.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *