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 repr oducible ex ample (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:
A minimal reproducible example consists of the following items:
A minimal dataset, necessary to reproduce the issue
The minimal runnable code necessary to reproduce the issue, which can be run
on the given dataset, and including the necessary information on the used packages.
Let's quickly go over each one of these with examples:
Minimal Dataset (Sample Data)
You need to provide a data frame that is small enough to be (reasonably) pasted on a post, but big enough to reproduce your issue.
Let's say, as an example, that you are working with the iris data frame
head(iris)
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1 5.1 3.5 1.4 0.…
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
system
Closed
January 14, 2022, 3:06pm
5
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.