Dear R-Help, I have the following type of table (with number of rows = 4765) and want to exclude each row where Net=0. Could this be done in a simple way? Thanks in advance Jim> ABusiness.Unit Event1 Net Date 1 General Fraud 170.000 2006-01-01 2 General Fraud 100.000 2007-11-09 3 General Fraud 486.286 2004-10-21 4 General Fraud 46.603 2005-04-25 5 Life Fraud 24.588 2006-02-28 6 Life Fraud 419.000 2007-11-23 7 Life Fraud 0 2006-07-13 8 Life Fraud 0 2006-07-13 9 General Fraud 47.000 2004-03-10 10 General Fraud 27.384 2003-07-01 11 General Fraud 20.436 2005-03-16 12 General Fraud 64.000 2004-01-01 13 General Fraud 16.414 2007-09-10 ------------------------------------------------------------------------------ This e-mail and any attachment may be confidential and may also be privileged. If you are not the intended recipient, please notify us immediately and then delete this e-mail and any attachment without retaining copies or disclosing the contents thereof to any other person. Thank you. ------------------------------------------------------------------------------
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Jim Gustafsson Sent: Tuesday, October 21, 2008 6:52 AM To: r-help at stat.math.ethz.ch Subject: [R] Exclude rows in table Dear R-Help, I have the following type of table (with number of rows = 4765) and want to exclude each row where Net=0. Could this be done in a simple way? Yes. help("[") Also see "An Introduction to R." Do your homework before posting, please. -- Bert Gunter Thanks in advance Jim> ABusiness.Unit Event1 Net Date 1 General Fraud 170.000 2006-01-01 2 General Fraud 100.000 2007-11-09 3 General Fraud 486.286 2004-10-21 4 General Fraud 46.603 2005-04-25 5 Life Fraud 24.588 2006-02-28 6 Life Fraud 419.000 2007-11-23 7 Life Fraud 0 2006-07-13 8 Life Fraud 0 2006-07-13 9 General Fraud 47.000 2004-03-10 10 General Fraud 27.384 2003-07-01 11 General Fraud 20.436 2005-03-16 12 General Fraud 64.000 2004-01-01 13 General Fraud 16.414 2007-09-10 ---------------------------------------------------------------------------- -- This e-mail and any attachment may be confidential and m...{{dropped:14}}
Tena koe Jim A[A[,'Net']!=0,] or A[!A[,'Net']%in%0,] Peter Alspach> -----Original Message----- > From: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] On Behalf Of Jim Gustafsson > Sent: Wednesday, 22 October 2008 2:52 a.m. > To: r-help at stat.math.ethz.ch > Subject: [R] Exclude rows in table > > > > Dear R-Help, > > I have the following type of table (with number of rows = > 4765) and want to exclude each row where Net=0. Could this > be done in a simple way? > > Thanks in advance > Jim > > > A > Business.Unit Event1 Net Date > 1 General Fraud 170.000 2006-01-01 > 2 General Fraud 100.000 2007-11-09 > 3 General Fraud 486.286 2004-10-21 > 4 General Fraud 46.603 2005-04-25 > 5 Life Fraud 24.588 2006-02-28 > 6 Life Fraud 419.000 2007-11-23 > 7 Life Fraud 0 2006-07-13 > 8 Life Fraud 0 2006-07-13 > 9 General Fraud 47.000 2004-03-10 > 10 General Fraud 27.384 2003-07-01 > 11 General Fraud 20.436 2005-03-16 > 12 General Fraud 64.000 2004-01-01 > 13 General Fraud 16.414 2007-09-10 > -------------------------------------------------------------- > ---------------- > This e-mail and any attachment may be confidential and may > also be privileged. > If you are not the intended recipient, please notify us > immediately and then delete this e-mail and any attachment > without retaining copies or disclosing the contents thereof > to any other person. > Thank you. > -------------------------------------------------------------- > ---------------- > ______________________________________________ > R-help at 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. >The contents of this e-mail are privileged and/or confidential to the named recipient and are not to be used by any other person and/or organisation. If you have received this e-mail in error, please notify the sender and delete all material pertaining to this e-mail.
On Tue, Oct 21, 2008 at 03:52:05PM +0200, Jim Gustafsson wrote:> I have the following type of table (with number of rows = 4765) and want > to exclude each row where Net=0. Could this be done in a simple way?subset(A, Net!=0) or A[A$Net!=0, ] See manual, section 2.7 cu Philipp -- Dr. Philipp Pagel Lehrstuhl f?r Genomorientierte Bioinformatik Technische Universit?t M?nchen Wissenschaftszentrum Weihenstephan 85350 Freising, Germany http://mips.gsf.de/staff/pagel