[R] Filtering an Entire Dataset based on Several Conditions

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Mon May 9 11:11:23 CEST 2022

Hi Paul,
Based on my guess that all values have been normalized, I would say:

df[abs(df) < 3]<-NA
       V1       V2       V3        V4
1       NA 4.675699 3.166625        NA
2       NA       NA       NA  3.463660
3 4.288831       NA 4.032902 -4.343869
4       NA       NA       NA        NA

Beware that this behavior of data frames may not persist in the
future. You may have to convert to a matrix and then convert the
result back again.


On Mon, May 9, 2022 at 6:24 PM Paul Bernal <paulbernal07 using gmail.com> wrote:
> Dear friends,
> I have a dataframe which every single (i,j) entry (i standing for ith row,
> j for jth column) has been normalized (converted to z-scores).
> Now I want to filter or subset the dataframe so that I only end up with a a
> dataframe containing only entries greater than -3 or less than 3.
> How could I accomplish this?
> Best,
> Paul
>         [[alternative HTML version deleted]]
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

More information about the R-help mailing list