I was doing a course on R and I came across this line of code:
onlineta_city_hotels <- filter(hotel_bookings,
(hotel=="City Hotel" &
hotel_bookings$market_segment=="Online TA"))
This code did successfully produce the expected result. However, I tried removing the dollar sign and executed a new code:
onlineta_city_hotels <- filter(hotel_bookings,
(hotel=="City Hotel" &
market_segment=="Online TA"))
This code showed the same result. So I wanted to know the need for using a dollar sign in such statements.