dplyr filter not filtering properly
1
0
Entering edit mode
5.1 years ago
c.fraser ▴ 10

Hello,

Relatively new to R and have run into a problem with dplyr filter. I'm trying to sort a dataframe by adjusted pvalues:

df
1   8.43080750411049e-06
2   1
3   0.155759491784278
4   0.504522013356758
5   4.93250063257857e-05
6   0.00346659769502134
7   2.94005754313656e-06
8   0.00010367418530406
9   8.49263820241248e-05
10  0.248619819594542
11  0.178341463282468
12  0.00345343780446894
13  2.1265862352706e-38
14  0.0118549063372728
15  8.19090405768653e-08

    filtered_df <- filter(df, padj < 0.05) 

filtered_df
1   0.00346659769502134
2   0.00010367418530406
3   0.00345343780446894
4   0.0118549063372728

filtered_df doesn't include any of the values shown in df that R has displayed in scientific notation. Am I doing something silly here? Any help much appreciated!

dplyr r • 1.8k views
ADD COMMENT
1
Entering edit mode
5.1 years ago

I would check if your data is actually numeric and if not - transform it using as.numeric()

ADD COMMENT
1
Entering edit mode

yep that sorted it! thank you!

ADD REPLY

Login before adding your answer.

Traffic: 1717 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6