How to work with Pre-loaded datasets?

Hello,
I am trying to practice R programming with 'airquality' that is a pre-loaded dataset in Rstudios.

I uploaded the dataset. But the problem is that whenever I try to give any logical statement like AND, OR or NOT, it shows an error message.

head(airquality)
Ozone Solar.R Wind Temp Month Day
1 41 190 7.4 67 5 1
2 36 118 8.0 72 5 2
3 12 149 12.6 74 5 3
4 18 313 11.5 62 5 4
5 NA NA 14.3 56 5 5
6 28 NA 14.9 66 5 6

Solar.R>100 & Wind>10
Error: object 'Solar.R' not found

Could anyone please help me by pointing out the mistake I am doing, or the step I am missing?

Thanks in advance.

1 Like

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

1 Like

Hi there,

I think you are missing the functions to run the logical statements.

Here is how you would filter the dataset for Solar.R greater than 100 and Wind greater than 10 using the dplyr package.

library(dplyr)

airquality %>%
  filter(Solar.R > 100 & Wind > 10)

[edited because previously I thought Solar.R needs to be wrapped in backticks — it doesn't!]

2 Likes

Thank you for the help.

You are right, I was missing the function.

1 Like

This topic was automatically closed 7 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.