this is what i needed! thank you.
> -Original Message-
> From: Jorge Ivan Velez [mailto:jorgeivanve...@gmail.com]
> Sent: Monday, April 13, 2009 12:50 PM
> To: Dan Dube
> Cc: r-help@r-project.org
> Subject: Re: [R] tapply output as a dataframe
>
>
&
i use tapply and by often, but i always end up banging my head against
the wall with the output.
is there a simpler way to convert the output of the following tapply to
a dataframe or matrix than what i have here:
# setup data for tapply
dt = data.frame(bucket=rep(1:4,25),val=rnorm(100))
fn = f
great! the "cut" function was exactly what i needed.
thank you both!
> -Original Message-
> From: Dimitris Rizopoulos [mailto:d.rizopou...@erasmusmc.nl]
> Sent: Monday, April 06, 2009 4:01 PM
> To: Dan Dube
> Cc: r-help@r-project.org
> Subject: Re:
is there a better way to bucket observations into more-or-less evenly
sized buckets than this? it seems like this must be a common operation:
dt = data.frame(points=rnorm(1000),bucket=NA)
breaks = quantile(dt$points,seq(0:1,.1))
for (i in 2:length(breaks)) {
if (i == 2) {
hello,
i have been trying to convert my data frames to matrices in the hopes of
speeding up some of my more complicated scripts.
to assist with this, i am trying to create a "matrix column operator"
like $:
"%$%" = function(data,field) {
as.numeric(data[,grep(field,unlist(dimnames(data)[2
5 matches
Mail list logo