Bug 17224 - ordered() with missing x arg throws an error
Summary: ordered() with missing x arg throws an error
Alias: None
Product: R
Classification: Unclassified
Component: Misc (show other bugs)
Version: R-devel (trunk)
Hardware: All All
: P5 trivial
Assignee: R-core
Depends on:
Reported: 2017-02-15 22:18 UTC by Richard Cotton
Modified: 2017-02-15 22:18 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Richard Cotton 2017-02-15 22:18:52 UTC
factor() returns a zero-length factor, as does factor(ordered = TRUE).

However, ordered() throws an error:

Error in factor(x, ..., ordered = TRUE) : 
  argument "x" is missing, with no default

This is sufficiently odd that I think that the behavior of ordered() either 

1. needs changing to match factor(), or
2. documenting with an example on the ?factor page.

In the former case, defining ordered() as

ordered <- function (...) {
  factor(..., ordered = TRUE)

solves the problem.