Skip to main content Link Search Menu Expand Document (external link)

Procedure 2: Establish Range in R

To establish the range of the Interim_Close in the AAPL data frame use the min() function typing:

min(AAPL$Interim_Close)

img.png

Run the line of script to console:

img_1.png

It can be seen that the smallest value in the Interim_Close vector of the AAPL data frame is 50.67, to retrieve the largest value use the max() function by typing:

range(AAPL$Interim_Close)

img_2.png

Run the line of script to console:

img_3.png

Run the line of script to console:

img_4.png

To establish the range value subtract the largest value from the smallest value which can be achieved by using the diff() function on the vector returned from the range() function as:

diff(range(AAPL$Interval_Close))

img_5.png

Run the line of script to console:

img_6.png

It can be seen that the range has been returned as being 651.43.


Jube™. © Jube Holdings Limited 2022 to present.