<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://lms.onnocenter.or.id/wiki/index.php?action=history&amp;feed=atom&amp;title=R%3A_time_series</id>
	<title>R: time series - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://lms.onnocenter.or.id/wiki/index.php?action=history&amp;feed=atom&amp;title=R%3A_time_series"/>
	<link rel="alternate" type="text/html" href="https://lms.onnocenter.or.id/wiki/index.php?title=R:_time_series&amp;action=history"/>
	<updated>2026-04-21T03:00:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://lms.onnocenter.or.id/wiki/index.php?title=R:_time_series&amp;diff=52595&amp;oldid=prev</id>
		<title>Onnowpurbo: Created page with &quot;Sumber: https://stat.ethz.ch/R-manual/R-devel/library/stats/html/ts.html  ts {stats}	R Documentation Time-Series Objects  Description The function ts is used to create time-se...&quot;</title>
		<link rel="alternate" type="text/html" href="https://lms.onnocenter.or.id/wiki/index.php?title=R:_time_series&amp;diff=52595&amp;oldid=prev"/>
		<updated>2018-11-09T21:35:26Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Sumber: https://stat.ethz.ch/R-manual/R-devel/library/stats/html/ts.html  ts {stats}	R Documentation Time-Series Objects  Description The function ts is used to create time-se...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Sumber: https://stat.ethz.ch/R-manual/R-devel/library/stats/html/ts.html&lt;br /&gt;
&lt;br /&gt;
ts {stats}	R Documentation&lt;br /&gt;
Time-Series Objects&lt;br /&gt;
&lt;br /&gt;
Description&lt;br /&gt;
The function ts is used to create time-series objects.&lt;br /&gt;
&lt;br /&gt;
as.ts and is.ts coerce an object to a time-series and test whether an object is a time series.&lt;br /&gt;
&lt;br /&gt;
Usage&lt;br /&gt;
&lt;br /&gt;
 ts(data = NA, start = 1, end = numeric(), frequency = 1,&lt;br /&gt;
    deltat = 1, ts.eps = getOption(&amp;quot;ts.eps&amp;quot;), class = , names = )&lt;br /&gt;
 as.ts(x, ...)&lt;br /&gt;
 is.ts(x)&lt;br /&gt;
&lt;br /&gt;
Arguments&lt;br /&gt;
&lt;br /&gt;
* data - a vector or matrix of the observed time-series values. A data frame will be coerced to a numeric matrix via data.matrix. (See also ‘Details’.)&lt;br /&gt;
* start - the time of the first observation. Either a single number or a vector of two integers, which specify a natural time unit and a (1-based) number of samples into the time unit. See the examples for the use of the second form.&lt;br /&gt;
* end - the time of the last observation, specified in the same way as start.&lt;br /&gt;
* frequency - the number of observations per unit of time.&lt;br /&gt;
* deltat - the fraction of the sampling period between successive observations; e.g., 1/12 for monthly data. Only one of frequency or deltat should be provided.&lt;br /&gt;
* ts.eps - time series comparison tolerance. Frequencies are considered equal if their absolute difference is less than ts.eps.&lt;br /&gt;
* class - class to be given to the result, or none if NULL or &amp;quot;none&amp;quot;. The default is &amp;quot;ts&amp;quot; for a single series, c(&amp;quot;mts&amp;quot;, &amp;quot;ts&amp;quot;, &amp;quot;matrix&amp;quot;) for multiple series.&lt;br /&gt;
* names - a character vector of names for the series in a multiple series: defaults to the colnames of data, or Series 1, Series 2, ....&lt;br /&gt;
* x - an arbitrary R object.&lt;br /&gt;
... 	&lt;br /&gt;
&lt;br /&gt;
arguments passed to methods (unused for the default method).&lt;br /&gt;
Details&lt;br /&gt;
&lt;br /&gt;
The function ts is used to create time-series objects. These are vectors or matrices with class of &amp;quot;ts&amp;quot; (and additional attributes) which represent data which has been sampled at equispaced points in time. In the matrix case, each column of the matrix data is assumed to contain a single (univariate) time series. Time series must have at least one observation, and although they need not be numeric there is very limited support for non-numeric series.&lt;br /&gt;
&lt;br /&gt;
Class &amp;quot;ts&amp;quot; has a number of methods. In particular arithmetic will attempt to align time axes, and subsetting to extract subsets of series can be used (e.g., EuStockMarkets[, &amp;quot;DAX&amp;quot;]). However, subsetting the first (or only) dimension will return a matrix or vector, as will matrix subsetting. Subassignment can be used to replace values but not to extend a series (see window). There is a method for t that transposes the series as a matrix (a one-column matrix if a vector) and hence returns a result that does not inherit from class &amp;quot;ts&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The value of argument frequency is used when the series is sampled an integral number of times in each unit time interval. For example, one could use a value of 7 for frequency when the data are sampled daily, and the natural time period is a week, or 12 when the data are sampled monthly and the natural time period is a year. Values of 4 and 12 are assumed in (e.g.) print methods to imply a quarterly and monthly series respectively.&lt;br /&gt;
&lt;br /&gt;
as.ts is generic. Its default method will use the tsp attribute of the object if it has one to set the start and end times and frequency.&lt;br /&gt;
&lt;br /&gt;
is.ts tests if an object is a time series. It is generic: you can write methods to handle specific classes of objects, see InternalMethods.&lt;br /&gt;
References&lt;br /&gt;
&lt;br /&gt;
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth &amp;amp; Brooks/Cole.&lt;br /&gt;
See Also&lt;br /&gt;
&lt;br /&gt;
tsp, frequency, start, end, time, window; print.ts, the print method for time series objects; plot.ts, the plot method for time series objects.&lt;br /&gt;
&lt;br /&gt;
For other definitions of ‘time series’ (e.g., time-ordered observations) see the CRAN task view at https://CRAN.R-project.org/view=TimeSeries.&lt;br /&gt;
Examples&lt;br /&gt;
&lt;br /&gt;
 require(graphics)&lt;br /&gt;
 &lt;br /&gt;
 ts(1:10, frequency = 4, start = c(1959, 2)) # 2nd Quarter of 1959&lt;br /&gt;
 print( ts(1:10, frequency = 7, start = c(12, 2)), calendar = TRUE)&lt;br /&gt;
 # print.ts(.)&lt;br /&gt;
 ## Using July 1954 as start date:&lt;br /&gt;
 gnp &amp;lt;- ts(cumsum(1 + round(rnorm(100), 2)),&lt;br /&gt;
           start = c(1954, 7), frequency = 12)&lt;br /&gt;
 plot(gnp) # using &amp;#039;plot.ts&amp;#039; for time-series plot&lt;br /&gt;
&lt;br /&gt;
 ## Multivariate&lt;br /&gt;
 z &amp;lt;- ts(matrix(rnorm(300), 100, 3), start = c(1961, 1), frequency = 12)&lt;br /&gt;
 class(z)&lt;br /&gt;
 head(z) # as &amp;quot;matrix&amp;quot;&lt;br /&gt;
 plot(z)&lt;br /&gt;
 plot(z, plot.type = &amp;quot;single&amp;quot;, lty = 1:3)&lt;br /&gt;
&lt;br /&gt;
 ## A phase plot:&lt;br /&gt;
 plot(nhtemp, lag(nhtemp, 1), cex = .8, col = &amp;quot;blue&amp;quot;,&lt;br /&gt;
      main = &amp;quot;Lag plot of New Haven temperatures&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
[Package stats version 3.6.0 Index]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Referensi==&lt;br /&gt;
&lt;br /&gt;
* https://stat.ethz.ch/R-manual/R-devel/library/stats/html/ts.html&lt;/div&gt;</summary>
		<author><name>Onnowpurbo</name></author>
	</entry>
</feed>