Re: [R] Simple question on binning data

2010-05-15 Thread Bernardo Rangel Tura
On Thu, 2010-05-13 at 17:31 -0400, Carl Witthoft wrote:
 It's very simple to write a binit() function.  If all you want to do 
 is e.g., bin 107 values into sums of 10 at a time, then write a loop 
 that sums x[10*i:11*i-1]  (not tested and not syntactically correct).
 
 The one I wrote for myself discards any partial bin (101-107 in my 
 example) and leaves a warning note that this took place.
 
 Carl

Hi Carl,

I think the syntactically correct is x[10*i:(11*i-1)]

-- 
Bernardo Rangel Tura, M.D,MPH,Ph.D
National Institute of Cardiology
Brazil

__
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.


Re: [R] Simple question on binning data

2010-05-14 Thread kMan
Wow! This definitely contributed to my evening.

If you could indulge, I would like some clarification on this matter of
binning and distortion, particularly wrt time series (perhaps related to
long-memory processes?). I had thought binning was standard practice in
spectral analysis and ANPOW. 

... snip
Bert is correct.  Binning is seldom needed and usually distorts.  It is the
statistical equivalent of a former governor from Alaska.

Frank
... snip

Sincerely,
KeithC.

__
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.


Re: [R] Simple question on binning data

2010-05-14 Thread Frank E Harrell Jr

On 05/14/2010 07:35 PM, kMan wrote:

Wow! This definitely contributed to my evening.

If you could indulge, I would like some clarification on this matter of
binning and distortion, particularly wrt time series (perhaps related to
long-memory processes?). I had thought binning was standard practice in
spectral analysis and ANPOW.

...snip
Bert is correct.  Binning is seldom needed and usually distorts.  It is the
statistical equivalent of a former governor from Alaska.

Frank
...snip

Sincerely,
KeithC.




My experience in time series is limited so I'll defer to others.
Frank

--
Frank E Harrell Jr   Professor and ChairmanSchool of Medicine
 Department of Biostatistics   Vanderbilt University

__
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.


[R] Simple question on binning data

2010-05-13 Thread george5000

Hello everyone,

I have a data set, and I need to bin my data using a bin width of say g(n).
Would anyone be willing to tell me how to do this in R?

Thanks
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Simple-question-on-binning-data-tp2202644p2202644.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] Simple question on binning data

2010-05-13 Thread Erik Iverson
There would be several people who could help if you gave us a minimal, 
reproducible example like the posting guide asks for.


If you have a vector of continuous data, and need to create a 
categorical variable (in R, a factor) from that continuous variable, 
then ?cut can help you.




george5000 wrote:

Hello everyone,

I have a data set, and I need to bin my data using a bin width of say g(n).
Would anyone be willing to tell me how to do this in R?

Thanks


__
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.


Re: [R] Simple question on binning data

2010-05-13 Thread Frank E Harrell Jr

On 05/13/2010 04:05 PM, Bert Gunter wrote:

?hist

However, I'm going to go way out on a limb here, as I know absolutely
nothing of what you're up to, and suggest that you do NOT need to bin your
data.

-- Bert


Bert is correct.  Binning is seldom needed and usually distorts.  It is 
the statistical equivalent of a former governor from Alaska.


Frank



Bert Gunter
Genentech Nonclinical Biostatistics



-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Erik Iverson
Sent: Thursday, May 13, 2010 1:51 PM
To: george5000
Cc: r-help@r-project.org
Subject: Re: [R] Simple question on binning data

There would be several people who could help if you gave us a minimal,
reproducible example like the posting guide asks for.

If you have a vector of continuous data, and need to create a
categorical variable (in R, a factor) from that continuous variable,
then ?cut can help you.



george5000 wrote:

Hello everyone,

I have a data set, and I need to bin my data using a bin width of say

g(n).

Would anyone be willing to tell me how to do this in R?

Thanks





--
Frank E Harrell Jr   Professor and ChairmanSchool of Medicine
 Department of Biostatistics   Vanderbilt University

__
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.


Re: [R] Simple question on binning data

2010-05-13 Thread Rolf Turner

On 14/05/2010, at 9:54 AM, Frank E Harrell Jr wrote:

SNIP

 snip Binning is seldom needed and usually distorts.  It is 
 the statistical equivalent of a former governor from Alaska.

SNIP

I nominate this for a fortune.

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
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.


Re: [R] Simple question on binning data

2010-05-13 Thread Dennis Murphy
I second it! Made me lol :)

Dennis

On Thu, May 13, 2010 at 3:03 PM, Rolf Turner r.tur...@auckland.ac.nzwrote:


 On 14/05/2010, at 9:54 AM, Frank E Harrell Jr wrote:

SNIP

  snip Binning is seldom needed and usually distorts.  It is
  the statistical equivalent of a former governor from Alaska.

 SNIP

 I nominate this for a fortune.

cheers,

Rolf Turner

 ##
 Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

 __
 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.


[[alternative HTML version deleted]]

__
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.