I am exploring the result of clustering a large multivariate data set
into a number of groups, represented, say, by a factor G.
I wrote a function to see how categorical variables vary between groups:
> ddisp <- function(dvar) {
+ csqt <- chisq.test(G,dvar)
+ print(csqt$statistic)
+ print(c
ddisp <- function(dvar) {
yn <- substitute(dvar)
csqt <- eval.parent(substitute(chisq.test(G,dvar), list(dvar=yn)))
}
There are other ways, such as forming the cross-classification table,
setting its dimnames and passing that to chisq.test.
On Mon, 13 Nov 2006, Murray Jorgens
Thanks for these suggestions, Professor Ripley. It's interesting that
the function parameters in R are not truly "dummy" as they can effect
the result of a function.
Murray
Prof Brian Ripley wrote:
> ddisp <- function(dvar) {
> yn <- substitute(dvar)
> csqt <- eval.parent(substitute(chis