[R] does there any function like sumif in excel?

John Kane jrkrideau at yahoo.ca
Mon Sep 29 16:20:38 CEST 2008

There are several ways to subset the dataframe 
?select will give you one.

or mydata[mydata$A=value]<- mydata

then apply sum()

I do not think there is one single command equivalent to sumif()

--- On Sun, 9/28/08, caocheng曹成 <caocheng8230 at gmail.com> wrote:

> From: caocheng曹成 <caocheng8230 at gmail.com>
> Subject: [R] does there any function like sumif in excel?
> To: R-help at r-project.org
> Received: Sunday, September 28, 2008, 10:25 PM
> I have a data.frame datas which have two columns A and B.
> I want to filter column A by some values and to get a value
> list which
> contain the value in B.
> Best wishes!
> 	[[alternative HTML version deleted]]
> ______________________________________________
> 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.

Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now at

More information about the R-help mailing list