On Apr 13, 2010, at 12:02 AM, Noah Silverman wrote:
David,
That helps me a lot. Thanks!!!
-N
On 4/12/10 9:06 PM, David Winsemius wrote:
dat <- as.data.frame(matrix( rnorm(200), 100 , 2)) # bivariate
normal n=100
ab <- matrix( c(-5,-5,5,5), 2, 2) # interval [-5,5) x [-5,5)
nbin <- c( 20, 20) # 400 bins
bins <- bin2(dat, ab, nbin) # bin counts,ab,nskip
dat$r1.cat <- cut(dat[,1], breaks=seq(ab[1,1], ab[1,2],
length.out=nbin[1]+1 ) )
dat$r2.cat <- cut(dat[,2], breaks=seq(ab[1,1], ab[1,2],
length.out=nbin[1]+1))
dat$bicat <- with(dat, paste( as.numeric(r1.cat),
as.numeric(r2.cat), sep="."))
That's great, however something isn't coming out right.
I pasted your code into R and it looks like I'm getting different
numbers bicat.
The numeric internals may not have bee the best choice if they got
sorted improperly. Leave out the as.numeric.
Should
You got cut off here. Hope all is well.
David.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.