R - simple
Here is a set of 14 tasks in the R language that will allow you to delve into various aspects of working with vectors and functions in this versatile programming language:
Create a 7-element vector named “results” with the following numerical values: 24, 22, 15, 21, 15, 17, 10.
Name the elements of the vector with the names of the days of the week.
Select the sixth and seventh elements of the vector “results” by referring to their names and store them in the vector “weekend”.
What is the minimum, maximum, and mean value of the vector “results”? Use the appropriate functions.
Create a 10-element vector W1 consisting of even numbers from 2 to 20.
Create a 12-element vector W2 from the repeating sequence of numbers 4, 8, and 12.
Combine vectors W1 and W2 into one vector W3.
Refer to (display):
a) To reference the 12th element of vector W3:
b) To reference the 2nd, 6th, and 9th elements of vector W3:
c) To reference the first six elements of vector W3:
Create a 20-element vector W4 consisting of randomly chosen numbers from the range 1 to 100.
Create a vector W5 which is the sum of vector W3 and vector W4 raised to the second power.
Display the minimum elements from corresponding elements of vectors W3 and W4.
Which elements of vector W5 are greater than 5000?
Create a vector W6 containing the integer part of dividing elements of vector W5 by 17.
Sort the elements of vector W6 in ascending order.
My site is free of ads and trackers. Was this post helpful to you? Why not