简体   繁体   English

如何引用 r 中的列中的值?

[英]How do I refer to a value in a column in r?

I am working with clinical data that includes the patient names as rows and the proteins as columns.我正在处理临床数据,其中包括患者姓名作为行和蛋白质作为列。 An extra column includes the white cell count for the patients and the values are Low, Medium, and High.额外的一列包括患者的白细胞计数,值为低、中和高。 How do I create a table that only includes patients with low white cell count Here is an image of my table.如何创建仅包含白细胞计数低的患者的表格这是我的表格的图像。 The column names are protein IDs列名是蛋白质 ID

If you are familiar with tidyverse , this is one way you could do it;如果您熟悉tidyverse ,这是您可以做到的一种方法;

df %>%
   filter(wcc_group == "Low")

Or, you could use base-r或者,您可以使用base-r

df <- subset(df, subset = (wcc_group == "Low"))

Where df is the name of your data.frame .其中df是您的data.frame的名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM