Logical operator

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Logical operator

Davidmac
Greetings fellows,

I am taking an online havardX class on Introduction to data science - R basics. In one of the assessments, I ran into a block and have been stuck for a long time now. Please, I'm in dire need of assistance with the following problems:

Using, abbs <- c("MA", "ME", "MI", "MO", "MU")

In a previous exercise, we computed the index abbs%in%murders$abb. Use which and the ! operator to get the index of the entries of abbs that are not abbreviations.

Show the entries of abbs that are not actual abbreviations.


Now, below are the instructions in the script:

# Store the 5 abbreviations in abbs. (remember that they are character vectors)
abbs <- c("MA", "ME", "MI", "MO", "MU")

# Use the `which` command and `!` operator to find out which index abbreviations are not actually part of the dataset and store in `ind`

# Names of abbreviations in `ind`