Logical operators

Topic: R Programming -> Logical operators
I just want to know the code that I'll have to write.
default dataset 'airquality'
Problem: How to specify rows that are extremely sunny and windy, Condition: having a Solar measurement of over 150 and a Wind measurement of over 10.
I'm trying with the following:
data <- airquality
Solar.R > 150 & Wind >10
But it keep saying that - Error: object 'Solar.R' not found

Hi Arindam,

Have you look here?

There are several ways, @ dromano has pointed you to the {tidyverse} approach.

The base R approach would be

dat1 <- subset(airquality,  Solar.R > 150 & Wind > 10 )

See ?subset

Another way would be to use the {data.table} package

DT <- as.data.table(airquality)
DT1 <-  DT[Solar.R > 150 & Wind > 10]

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.