
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Create Time Series Plot in R Without Time Vector
To create a time series plot in R without time vector, we can use ts.plot function.
For Example, if we have a vector called X then we can create the time series plot of X by using the command ts.plot(X), the Output of this command will have a time axis in place of X-axis. Check out the below Examples to understand how it works.
Example 1
Consider the following vector −
x<-rnorm(10) ts.plot(x)
Output
If you execute the above given snippet, it generates the following Output −
Example 2
To create a time series plot in R without time vector, add the following code to the above snippet −
y<-rpois(10,5) ts.plot(y)
Output
If you execute all the above given snippets as a single program, it generates the following Output −
Advertisements