ID EN
Vector & List

cut.POSIXt

R Base 3.6.2 🇮🇩 Bahasa Indonesia

Metode pemotongan diterapkan pada objek tanggal-waktu.

Syntax

R
# S3 method for POSIXt
cut(x, breaks, labels = NULL, start.on.monday = TRUE,
    right = FALSE, &#8230;)<p></p><p># S3 method for Date
cut(x, breaks, labels = NULL, start.on.monday = TRUE,
    right = FALSE, &#8230;)</p>

Arguments

Parameter Deskripsi
x an object inheriting from class "POSIXt" or "Date".
breaks a vector of cut points or number giving the number of intervals which x is to be cut into or an interval specification, one of "sec", "min", "hour", "day", "DSTday", "week", "month", "quarter" or "year", optionally preceded by an integer and a space, or followed by "s". (For "Date" objects only interval specifications using "day", "week", "month", "quarter" and "year" are allowed.)
labels labels for the levels of the resulting category. By default, labels are constructed from the left-hand end of the intervals (which are included for the default value of right). If labels = FALSE, simple integer codes are returned instead of a factor.
start.on.monday logical. If breaks = "weeks", should the week start on Mondays or Sundays?
right, &#8230; arguments to be passed to or from other methods.

Return Value

Sebuah faktor dikembalikan, kecuali label = FALSE yang mengembalikan kode tingkat bilangan bulat. Nilai yang berada di luar rentang jeda diberi kode sebagai NA, demikian pula nilai NA.

Details

Perhatikan bahwa default untuk hak berbeda dari metode default. Menggunakan include.lowest = TRUE akan menyertakan kedua ujung rentang tanggal. Menggunakan istirahat = "kuartal" akan membuat interval 3 bulan kalender, dengan interval dimulai pada 1 Januari, 1 April, 1 Juli, atau 1 Oktober (berdasarkan min(x)) yang sesuai. Vektor jeda akan diurutkan sebelum digunakan: label harus sesuai dengan vektor yang diurutkan.

Contoh

Example
R
# NOT RUN {
## random dates in a 10-week period
cut(ISOdate(2001, 1, 1) + 70*86400*stats::runif(100), "weeks")
cut(as.Date("2001/1/1") + 70*stats::runif(100), "weeks")

# The standards all have midnight as the start of the day, but some
# people incorrectly interpret it at the end of the previous day ...
tm <- seq(as.POSIXct("2012-06-01 06:00"), by = "6 hours", length.out = 24)
aggregate(1:24, list(day = cut(tm, "days")), mean)
# and a version with midnight included in the previous day:
aggregate(1:24, list(day = cut(tm, "days", right = TRUE)), mean)
# }

See Also

seq.POSIXt seq.Date cut