R Programming: Create a vector which contains 10 random integer values between -50 and +50
R Programming: Basic Exercise-4 with Solution
Write a R program to create a vector which contains 10 random integer values between -50 and +50.
Sample Solution :
R Programming Code :
v = sample(-50:50, 10, replace=TRUE) print("Content of the vector:") print("10 random integer values between -50 and +50:") print(v)
 "Content of the vector:"  "10 random integer values between -50 and +50:"  31 -13 -21 42 49 -39 20 12 39 -2
R Programming Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a R program to create a sequence of numbers from 20 to 50 and find the mean of numbers from 20 to 60 and sum of numbers from 51 to 91.
Next: Write a R program to get the first 10 Fibonacci numbers.
Test your Python skills with w3resource's quiz
What is the difficulty level of this exercise?
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework