Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how do I create a dataframe based on values from another dataframe?

i have a data frame, from this I created another dataframe,
which consists of a selection after a number of conditions. The result is a number of countries that satisfy the condition n > 11.
Now I want to continue working with only these countries. How can I copy values from the first dataset based on the countries in the selection?

My first df looks like:

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

and the second (so the selection of countries):

enter image description here

In my final df I need every column and row from my 1st df (but only for the countries present in the second df)

>Solution :

I’m not sure about your data and reason using second dataframe, but let first and second data as df1 and df2, then

library(dplyr)

df1 %>%
  fliter(Country.o... %in% df2$Country.o...)

(I cannot find out what is the column name. You should not post your data as an imange)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading