Skip to contents

These functions check if the index is regular (index_regular()), and summarise the index variable (index_summary()). This can be useful to check your index variables.

Usage

index_regular(.data, ...)

# S3 method for tbl_ts
index_regular(.data, ...)

# S3 method for data.frame
index_regular(.data, index, ...)

index_summary(.data, ...)

# S3 method for tbl_ts
index_summary(.data, ...)

# S3 method for data.frame
index_summary(.data, index, ...)

Arguments

.data

data.frame or tsibble

...

extra arguments

index

the proposed index variable

Value

logical TRUE means it is regular, FALSE means not

Examples

# a tsibble
index_regular(heights)
#> [1] FALSE

# some data frames
index_regular(pisa, year)
#> [1] TRUE
index_regular(airquality, Month)
#> [1] TRUE

# a tsibble
index_summary(heights)
#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#>    1550    1730    1820    1818    1910    2000 
# some data frames
index_summary(pisa, year)
#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#>    2000    2004    2009    2009    2014    2018 
index_summary(airquality, Month)
#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#>       5       6       7       7       8       9 
index_summary(airquality, Day)
#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#>     1.0     8.5    16.0    16.0    23.5    31.0