Lasitha Yapa Lasitha Yapa - 2 years ago 84
SQL Question

Similar function to SQL where clause in R

I have a data set assigned to a variable named 'temps', which have columns 'date', 'temperature', 'country'.

I want to do something like this, which I can do in SQL

SELECT * FROM temps WHERE country != 'mycountry'

How can I do similar selection in R?

Answer Source

We can use similar syntax in base R

temps[temps$country != "mycountry",]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download