Compute a sequence of about `n+1`

equally spaced ‘nice’
values which cover the range of the values in `x`

, possibly of
length one, when `min.n = 0`

and there is only one unique
`x`

.

1 2 3 4 |

`x` |
an object of class |

`n` |
integer giving the |

`min.n` |
nonnegative integer giving the |

`sep` |
character string, serving as a separator for certain formats (e.g., between month and year). |

`...` |
further arguments for compatibility with the generic, ignored. |

A vector (of the suitable class) of locations, with attribute
`"labels"`

giving corresponding formatted character labels.

`pretty`

for the default method.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
pretty(Sys.Date())
pretty(Sys.time(), n = 10)
pretty(as.Date("2000-03-01")) # R 1.0.0 came in a leap year
## time ranges in diverse scales:% also in ../../../../tests/reg-tests-1c.R
require(stats)
steps <- setNames(,
c("10 secs", "1 min", "5 mins", "30 mins", "6 hours", "12 hours",
"1 DSTday", "2 weeks", "1 month", "6 months", "1 year",
"10 years", "50 years", "1000 years"))
x <- as.POSIXct("2002-02-02 02:02")
lapply(steps,
function(s) {
at <- pretty(seq(x, by = s, length = 2), n = 5)
attr(at, "labels")
})
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.