Logical function not working properly

Hi there!
I'm currently learning on R on my own and I ran into some problems this morning. If anybody cared to know, I'm currently reading the book called "Hands-On Programming with R" by O'Reilly. On page 84, I'm trying to replicate the logical function and output of "deck4$suit == "hearts". FYI, "hearts" fall under the column "suit". However, the output on my computer kept giving me all FALSEs instead of TRUEs for the last few values that actually read "hearts". I tried to delete the old CSV file containing the data that I was working with on my computer and created a new one. However, the function is still giving me the word FALSEs as my outputs. Could there be something going on with my computer?

Very unlikely, I suspect you are just reading the data as factors instead of character strings that is why your code gives an unexpected result.

If you need more specific help, please prepare a reproducible example (reprex) illustrating your issue.

Have a look at this guide, to see how to create one: