Hi Richard,
I think there may be something amiss in the plot.table function. As
you note, changing the class of fr to array produces a more sensible
plot, as does Bert's "as.vector". Yet inside plot.table we find:
plot(x0, unclass(x), ...
and that should produce an array:
class(unclass(fr))
[1]
Rich:
Simpler: Just lose the "table" class.
plot(as.numeric(names(fr)), as.vector(fr), type="h",
xlab="Determinant", ylab="Frequency")
However, I'm no less puzzled by the "strange" behavior than you.
In addition, it's probably worth noting that xyplot in lattice (and no
doubt ggpl
## This example is from R-intro.pdf page 21 (R-3.3.2)
d <- outer(0:9, 0:9)
fr <- table(outer(d, d, "-"))
plot(as.numeric(names(fr)), fr, type="h",
xlab="Determinant", ylab="Frequency")
## The y-axis tick marks are at c(-21,24,65).
## This seems to be because class(fr) == "table"
## Sw
Hi Zhao,
This is not a direct answer to your question, but a suggestion for a
different approach. The ordinal package was designed to cope with
issues like this (parameter constraints in ordinal regression models)
- try the following:
> library(ordinal)
> data(wine, package="ordinal")
> ## Fit mo
4 matches
Mail list logo