On 12/10/2009 10:36 AM, BIGBEEF wrote:
Hi - I'm having difficulty with frequencies in R. I have a table with a
variable (column) called "difference" 600 observations (rows). I would like
to know how many values are<  -0.5 as well as how many are>  0.5. The rest
are obviously in the middle.

In SAS I could this immediately but am unable to do it in R.
Hi Martin,

difference<-runif(100)*2-1
table(cut(difference,
 breaks=c(min(difference)-0.1,-0.5,0.5,max(difference))))

The "-0.1" is to ensure that the lowest value is included in the cut.

Jim

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

Reply via email to