Question: RStudio: When I use this command: A %>% filter(sex == female, comorb == 0,death == 1) I have the result: patientID age sex treatment death

RStudio:

When I use this command:

A %>% filter(sex == "female", comorb == 0,death == 1)

I have the result:

patientID age sex treatment death years comorb treat

1 qmn837s 60 female drugB 1 1.504703 0 2

2 byg337o 62 female drugB 1 4.026012 0 2

3 znz452q 61 female placebo 1 3.302813 0 0

4 fga249x 62 female placebo 1 3.873409 0 0

5 ind522k 61 female placebo 1 3.387192 0 0

My question is:

I need to add to my filter also age==min(age), but the result:

A %>% filter(sex == "female", comorb == 0,death == 1 & age==min(age))

[1] patientID age sex treatment death years comorb treat

<0 rows> (or 0-length row.names)

or

A$patientID[A$sex == "female" & A$age == min(A$age[A$sex == "female"]) & A$comorb == 0 & A$death == 1]

<0 rows> (or 0-length row.names)

This answer is incorrect, because on the table: qmn837s

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!