Total beginner question: Why can't R find certain objects in the dataset "nycflights13"?

The objects I am looking for do exist in the dataset nycflights13, but when I wanted to check if R can find these, R responded with [1] FALSE as shown in the photo 00|292x500

Hi,

You need quotes around the values you want to filter on. Without the quotes R assumes that they are objects. For instance: filter(flights, dest == "LGA" | dest == "IAH").

You can look here for a very good introduction to R: https://r4ds.had.co.nz/.

1 Like

Just a slight gloss. To see if something is an object, use

ls()

which will return a list of all objects in the workspace.

R also knows about other objects, such as packages that have been installed and the data objects in them, such as the famous data(iris) dataset.

Otherwise, a string, such as "LAX" can be assigned to an object or given as an argument to a function.

origin <- "LAX"
install.packages("dplyr")

and that's the long-winded explanation of @pete's advice to enclose the string in quotes when you see that message.

1 Like

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