# [R] apply'ing cut to a data.set column

Massimo Santini santini at dsi.unimi.it
Mon Jun 5 15:35:59 CEST 2000

```Hi all,
there is probably something I'm still missing about how R
manipulates multivariate data. I have a dataset in which, for various
tuples of a set of 4 parameters, a value of interest is stored:

p1   p2   p3   p4     v
0    0    0    0      0.2342
0    1    1    0      0.6124
....
0    0    1    1      0.1234

What I would like to do is to "cut" the "v" column of the dataset, let say
with two breaks: (0,.5] (.5,1], to obtain something like

p1   p2   p3   p4     v
0    0    0    0      (0,.5]
0    1    1    0      (.5,1]
....
0    0    1    1      (0,.5]

I now how to do it on data\$v, using cut, but I can't see a
simple/straightforward way to do it on all the dataset, I'm confused about
tapply, sapply, lapply and firends....

Is there a place where I can find a more complete treatment of how R uses
multivariate data?

thanks in advance for any suggestion...
Massimo

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```