The R Project SVN R

Rev

Rev 27541 | Rev 33534 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27541 Rev 27733
Line 59... Line 59...
59
  \code{\link{split}} for splitting a variable according to a group factor;
59
  \code{\link{split}} for splitting a variable according to a group factor;
60
  \code{\link{factor}}, \code{\link{tabulate}}, \code{\link{table}},
60
  \code{\link{factor}}, \code{\link{tabulate}}, \code{\link{table}},
61
  \code{\link{findInterval}()}.
61
  \code{\link{findInterval}()}.
62
}
62
}
63
\examples{
63
\examples{
64
Z <- stats::rnorm(10000)
64
Z <- rnorm(10000)
65
table(cut(Z, br = -6:6))
65
table(cut(Z, br = -6:6))
66
sum(table(cut(Z, br = -6:6, labels=FALSE)))
66
sum(table(cut(Z, br = -6:6, labels=FALSE)))
67
sum(   hist  (Z, br = -6:6, plot=FALSE)$counts)
67
sum(   hist  (Z, br = -6:6, plot=FALSE)$counts)
68
 
68
 
69
cut(rep(1,5),4)#-- dummy
69
cut(rep(1,5),4)#-- dummy
Line 81... Line 81...
81
which(is.na(cx));  x[is.na(cx)]  #-- the first 9  values  0
81
which(is.na(cx));  x[is.na(cx)]  #-- the first 9  values  0
82
which(is.na(cxl)); x[is.na(cxl)] #-- the last  5  values  8
82
which(is.na(cxl)); x[is.na(cxl)] #-- the last  5  values  8
83
 
83
 
84
 
84
 
85
## Label construction:
85
## Label construction:
86
y <- stats::rnorm(100)
86
y <- rnorm(100)
87
table(cut(y, breaks = pi/3*(-3:3)))
87
table(cut(y, breaks = pi/3*(-3:3)))
88
table(cut(y, breaks = pi/3*(-3:3), dig.lab=4))
88
table(cut(y, breaks = pi/3*(-3:3), dig.lab=4))
89
 
89
 
90
table(cut(y, breaks =  1*(-3:3), dig.lab=4))# extra digits don't "harm" here
90
table(cut(y, breaks =  1*(-3:3), dig.lab=4))# extra digits don't "harm" here
91
table(cut(y, breaks =  1*(-3:3), right = FALSE))#- the same, since no exact INT!
91
table(cut(y, breaks =  1*(-3:3), right = FALSE))#- the same, since no exact INT!