[R] KLdiv question (data.frame)

Ralf B ralf.bierig at gmail.com
Thu Jul 15 23:15:06 CEST 2010


Hi all,

I wonder why KLdiv does not work with data.frames:

n <- 50
mydata <- data.frame(
	sequence=c(1:n),
	data1=c(rnorm(n)),
	data2=c(rnorm(n))
)
# does NOT work
KLdiv(mydata)
# works fine
dataOnly <- cbind(mydata$data1, mydata$data2, mydata$group)
KLdiv(dataOnly)


Any ideas? Is there a better implementation that can deal with
data.frame or is there a simpler way of converting?

Ralf



More information about the R-help mailing list