Index: src/library/stats/R/kruskal.test.R =================================================================== --- src/library/stats/R/kruskal.test.R (revision 74631) +++ src/library/stats/R/kruskal.test.R (working copy) @@ -45,7 +45,7 @@ OK <- complete.cases(x, g) x <- x[OK] g <- g[OK] - if (!all(is.finite(g))) + if (!is.character(g) & !all(is.finite(g))) stop("all group levels must be finite") g <- factor(g) k <- nlevels(g) Index: src/library/stats/man/kruskal.test.Rd =================================================================== --- src/library/stats/man/kruskal.test.Rd (revision 74631) +++ src/library/stats/man/kruskal.test.Rd (working copy) @@ -22,11 +22,13 @@ \item{x}{a numeric vector of data values, or a list of numeric data vectors. Non-numeric elements of a list will be coerced, with a warning.} - \item{g}{a vector or factor object giving the group for the + \item{g}{a character vector, numeric vector, or factor + giving the group for the corresponding elements of \code{x}. Ignored with a warning if \code{x} is a list.} \item{formula}{a formula of the form \code{response ~ group} where - \code{response} gives the data values and \code{group} a vector or + \code{response} gives the data values and \code{group} a + character vector, numeric vector, or factor of the corresponding groups.} \item{data}{an optional matrix or data frame (or similar: see \code{\link{model.frame}}) containing the variables in the @@ -52,7 +54,8 @@ list, use \code{kruskal.test(list(x, ...))}. Otherwise, \code{x} must be a numeric data vector, and \code{g} must - be a vector or factor object of the same length as \code{x} giving + be a numeric vector, character vector, or factor of the same length + as \code{x} giving the group for the corresponding elements of \code{x}. } \value{