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,450 points
27 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,680 points
38 views
0 votes
1 answer
0 votes
1 answer

Sample random rows in DataFrame in R

First we should have some data: df1<-data.frame(matrix(rnorm(20), nrow=10)) > ...READ MORE

answered Apr 13, 2018 in Data Analytics by DeepCoder786
• 1,700 points
290 views
0 votes
1 answer

Rename a single column in dataframe using R

colnames(Samp)[2] <- "newname2" This sets the name of ...READ MORE

answered Apr 13, 2018 in Data Analytics by kappa3010
• 2,010 points
248 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
290 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
28 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
82 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
42 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
34 views