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
• 10,620 points
4,215 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

+1 vote
3 answers

How to change the value of a variable using R programming in a data frame?

Try this: df$symbol <- as.character(df$symbol) df$symbol[df$sym ...READ MORE

answered Jan 11, 2019 in Data Analytics by Tyrion anex
• 8,700 points
35,823 views
0 votes
1 answer

How to use the switch statement in R functions?

Switch definitely wasn't intended to operate this ...READ MORE

answered Jun 24, 2022 in Data Analytics by Sohail
• 3,040 points
589 views
0 votes
1 answer

how to use the Box-Cox power transformation in R

Yes, you are on the right track ...READ MORE

answered Jun 22, 2023 in Data Analytics by anonymous
• 1,380 points
1,163 views
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 6, 2019 in Data Analytics by anonymous
14,090 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,250 points
3,825 views
+1 vote
2 answers

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
82,288 views
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 Parth
• 4,640 points
1,913 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,250 points
3,938 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
• 52,350 points
1,918 views
+1 vote
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,840 points
1,091 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP