Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use subset to judge and filter data according to the conditions of the data box

2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to use subset to judge and filter data according to the conditions of the data box. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Use subset to select qualified data from the data box

Subset (x,...)

X represents a data frame to be filtered

For example, there are the following data:

> dat Samples group treatment Time1 GSM1625995 con6h control 6h2 GSM1625996 con6h control 6h3 GSM1625997 con6h control 6h4 GSM1625998 con12h control 12h5 GSM1625999 con12h control 12h6 GSM1626000 con12h control 12h7 GSM1626001 con24h control 24h8 GSM1626002 con24h control 24h9 GSM1626003 con24h control 24h10 GSM1626004 hm6h treat 6h11 GSM1626005 hm6h treat 6h12 GSM1626006 hm6h treat 6h13 GSM1626007 hm12h treat 12h14 GSM1626008 hm12h treat 12h15 GSM1626009 hm12h treat 12h16 GSM1626010 hm24h treat 24h17 GSM1626011 hm24h treat 24h18 GSM1626012 hm24h treat for 24 hours

One selection condition: select all con6h data in the data box (group column)

> con6h = subset (dat,group = = "con6h") > con6h Samples group treatment Time1 GSM1625995 con6h control 6h2 GSM1625996 con6h control 6h3 GSM1625997 con6h control 6h >

Multiple conditional selection: select control for 24 hours (according to treatment and Time columns)

> con24h = subset (dat,treatment== "control" & Time = = "24 hours") > con24h Samples group treatment Time7 GSM1626001 con24h control 24h8 GSM1626002 con24h control 24h9 GSM1626003 con24h control 24 hours

Extract the specified area after judgment

> con24h = subset (dat,treatment== "control" & Time = = "24h", select = c ("Samples", "group")) > con24h Samples group7 GSM1626001 con24h8 GSM1626002 con24h9 GSM1626003 con24h Thank you for reading! On "how to use subset to judge and filter data according to the conditions of the data box" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report