Practical 6: Implementation of Classification algorithm in R
Programming.
Theory
A time series is a sequence of data points recorded at regular
time intervals.
In R, the ts() function is used to convert numeric data into a
time series object.
The plot() function generates a graphical representation of
the time series, and the png() and [Link]() functions are
used to save the plot as an image file.
Explanation
1. Data Entry
Rainfall values for 12 months are stored in a numeric
vector.
2. Creating Time Series
The ts() function converts the vector into a time series
starting from January 2012 with a monthly frequency
(12).
3. Displaying the Time Series
print() outputs the time series data in a structured
format (year and month).
4. Saving the Plot
o png() opens a graphics device to save the plot as
[Link].
o plot() generates a line graph of the time series
showing rainfall variation over the year.
o [Link]() closes the graphics device and completes
the file creation.
5. Opening the Image
browseURL() automatically opens the saved PNG file.
Output
A PNG image titled "Monthly Rainfall (2012)" showing the
monthly variation in rainfall as a time series line plot.