How to use the where clause in R programming?

0 votes

I'm trying to implement a where clause within ggplot. Is this possible? 

My problem statement is that, I'm using the diamonds table and I want to select records where the cut = "Good". Cut is a field in the Diamond table. The Cut field can equal "Fair", "Good", Very Good", "Premium", and "Ideal".

diamonds[1:5,]
#   carat     cut   color  clarity    depth  table   price         x    y    z
# 1  0.23   Ideal       E      SI2     61.5     55     326      3.95 3.98 2.43  

I want to use some type of conditional statement against a CSV read file. But to keep my example simple, I using the diamond table as a typical example of my problem. I want to filter cut = "Good" but to include fields related to the records = "Good".

Any help would be appreciated.

Dec 24, 2018 in Data Analytics by Sophie may
• 9,870 points
510 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Data Analytics

0 votes
2 answers
0 votes
2 answers

How to use group by for multiple columns in dplyr, using string vector input in R?

data = data.frame(   zzz11def = sample(LETTERS[1:3], 100, replace=TRUE),   zbc123qws1 ...READ MORE

answered Aug 5 in Data Analytics by anonymous
3,620 views
0 votes
1 answer

How to find out the sum/mean for multiple variables per group in R?

You can use the reshape2 package for ...READ MORE

answered Apr 12, 2018 in Data Analytics by DataKing99
• 8,130 points
436 views
0 votes
1 answer

Which function can I use to clear the console in R and RStudio ?

Description                   Windows & Linux           Mac Clear console                      Ctrl+L ...READ MORE

answered Apr 17, 2018 in Data Analytics by anonymous
1,969 views
0 votes
1 answer

How to find out the package version which is loaded in R?

You can use sessionInfo() to accomplish that. > ...READ MORE

answered Apr 18, 2018 in Data Analytics by zombie
• 3,690 points
34 views
0 votes
1 answer
0 votes
1 answer

How to connect Java program to the MySQL database?

You can connect your Java code with ...READ MORE

answered May 11, 2018 in Java by parth295
• 4,640 points
213 views
0 votes
1 answer

IN vs OR in the SQL WHERE Clause

I assume you want to know the ...READ MORE

answered Sep 24, 2018 in Database by DataKing99
• 8,130 points
41 views
0 votes
1 answer

Is it possible to use a where clause within ggplot?

You can use the subset function to filter rows ...READ MORE

answered Nov 5, 2018 in Data Analytics by Kalgi
• 42,510 points
80 views
0 votes
1 answer

How to read R errors through JRI

You'll be able to perform those R-Expressions, ...READ MORE

answered Nov 8, 2018 in Data Analytics by Maverick
• 10,040 points
35 views