This function defines a pretty sequence given data, limits and parameters.

pretty_seq(x, lim = NULL, pretty_args = list(n = 5))

Arguments

x

An object representing some data to be plotted (e.g., x values).

lim

(optional) A vector of length two which define the limits within which the sequence should lie.

pretty_args

A named list of arguments passed to pretty_x().

Value

A list comprising 'at', a pretty sequence; and 'lim', limits, which may have been adjusted.

Author

Edward Lavender

Examples

pretty_seq(0:10)
#> $at #> [1] 0 2 4 6 8 10 #> #> $lim #> [1] 0 10 #> attr(,"user") #> [1] FALSE FALSE #>
pretty_seq(0:10, lim = c(0, 9))
#> $at #> [1] 0 2 4 6 8 #> #> $lim #> [1] 0 9 #> attr(,"user") #> [1] TRUE TRUE #>
pretty_seq(seq.Date(as.Date("2016-01-01"), as.Date("2016-01-12"), 1))
#> $at #> [1] "2016-01-01" "2016-01-03" "2016-01-05" "2016-01-07" "2016-01-09" #> [6] "2016-01-11" "2016-01-13" #> #> $lim #> [1] "2016-01-01" "2016-01-13" #>
pretty_seq(seq.Date(as.Date("2016-01-01"), as.Date("2016-01-12"), 1), pretty_args = list(n = 3))
#> $at #> [1] "2016-01-01" "2016-01-06" "2016-01-11" "2016-01-16" #> #> $lim #> [1] "2016-01-01" "2016-01-16" #>