[R] Making cuts on multivariate data
dwinsemius at comcast.net
Mon Aug 30 07:04:15 CEST 2010
On Aug 30, 2010, at 12:57 AM, David Winsemius wrote:
> On Aug 29, 2010, at 10:50 PM, Erik Ramberg wrote:
>> I'm a newbie to R and I was hoping someone could answer a simple
>> question. I want to read in an ASCII file with 3 columns - x,y,z.
>> Let's say there is a lot of data - 100,000 entries. I then want to
>> histogram x values that pass arbitrary (and complicated) cuts on y
>> and/or z. Likewise, I want to make a scatterplot with x and y,
>> with a cut on z values. Perhaps you have to redefine the vectors
>> I'm thinking along the lines of
>> hist(x) for y>0 .and. sqrt(z)<4
> If the data is in a dataframe named dta with columns x,y, and z then:
> with( dta[which( dta$y > 0 & sqrt(z) < 4), ],
> hist(x) )
with( dta[which( dta$y > 0 & sqrt(dta$z) < 4), ],
>> plot(x,y) for x>0 .and. y>0 .and.z**2 > 100
> The strategy generalizes.
>> I cant find this simple task in a first perusal of some of the
>> Any suggestions you could give would be helpful.
> Don't forget to read the Posting Guide.
More information about the R-help