Filter something from dataframe in an order in R

0 votes
I have a data frame and I need to filter out one field in a particular order. Is that possible?
Dec 12, 2018 in Data Analytics by Ali
• 10,430 points
41 views

1 answer to this question.

0 votes

You can use conditional filtering for this purpose. Something like:

df[!(df$gender == "woman" & df$age > 40 & df$bp = "high"), ]

where df is the dataframe which has three variables - gender, age and bp. Hope this helps.

answered Dec 12, 2018 by Maverick
• 10,040 points

Related Questions In Data Analytics

0 votes
1 answer

Reshape dataframe without “timevar” from long to wide format in R

Assuming that the data is in the ...READ MORE

answered Jun 13, 2018 in Data Analytics by CodingByHeart77
• 3,690 points
62 views
0 votes
1 answer

Store a built in dataset or dataframe from R to database

dbWriteTable() function allows you to store data ...READ MORE

answered Jul 29 in Data Analytics by anonymous
• 31,840 points
23 views
0 votes
1 answer

Read from database and store in R as dataframe

Your code would fetch you a MySQL ...READ MORE

answered Jul 29 in Data Analytics by anonymous
• 31,840 points
32 views
0 votes
1 answer

Create an animation from images in R

Create a vector with all frames required ...READ MORE

answered Aug 7 in Data Analytics by anonymous
• 31,840 points
20 views
0 votes
1 answer

Error saying "vector size cannot be NA" when using R with data mining

You can use the removesparseterm function.  Removes sparse ...READ MORE

answered Nov 15, 2018 in Data Analytics by Maverick
• 10,040 points
520 views
+1 vote
2 answers
0 votes
1 answer

Trying to find frequent itemsets of a data set using arules package

Try replacing ID <- c("A123","A123","A123","A123","B456","B456","B456") item <- c("bread", "butter", "milk", ...READ MORE

answered Nov 15, 2018 in Data Analytics by Maverick
• 10,040 points
43 views
0 votes
1 answer

Error saying "Error in df$item : object of type 'closure' is not subsettable" when trying to use arules package

Try replacing ID <- c("A123","A123","A123","A123","B456","B456","B456") item <- c("bread", "butter", ...READ MORE

answered Nov 15, 2018 in Data Analytics by Maverick
• 10,040 points
177 views
0 votes
1 answer

How is R applied in real world?

R Programming gives a broad variety of ...READ MORE

answered Oct 29, 2018 in Data Analytics by Maverick
• 10,040 points
164 views
0 votes
1 answer

Difference between factor and as.factor in R programming

Hey @Ali, as.factor is a wrapper for ...READ MORE

answered Oct 29, 2018 in Data Analytics by Maverick
• 10,040 points
324 views