Hi,
maybe this:
df<-data.frame(a=c(1,2,3,Inf,4,Inf),b=c(Inf,2,3,4,5,8))
df[apply(df,1, function(x) !any(x==Inf)),]
df[apply(df,1, function(x) any(x==Inf)),]
Andrija
On Tue, Mar 15, 2011 at 10:44 PM, Alexy Khrabrov
<deliverable@gmail.com>wrote:
> How do I apply a function to every row of a dataframe most naturally?
> Specifically, I'd like to filter out any row which contains an Inf in
any
> column. Since all columns are numeric, I guess max should work on a row...
>
> -- Alexy
> ______________________________________________
> R-help@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.
>
[[alternative HTML version deleted]]