Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Basically, I have a gene dataset in which the rows are genes and columns are sequential time points of protein folding. I need a function to filter genes of a certain threshold value from others across the entire data set, not just for certain vectors. For example:

          alpha98 alpha105 alpha112 alpha119
YAL002W      0.22     0.58    -0.36     0.13
YAL003W      0.05     0.55    -0.08     0.33

Any help would be great.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

R is vectorized and R recycles. That means, that generally, something as simple as myDF > threshold will get you awfully close to what you need.

Specifically, it will give you a logical matrix of the same dimensions as your data.frame which will be TRUE when that cell in the DF exceeds the threshold (and FALSE otherwise).

You can then use that matrix as your tool to subset the data.frame.

myDF[myDF > threshold]  

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...