wurmlab / SBC361-programming-in-R

QMUL's programming in R course
https://wurmlab.github.io/SBC361-programming-in-R/practical1.html
5 stars 11 forks source link

practical 1: Confusion between logical and regular expressions #22

Closed roddypr closed 6 years ago

roddypr commented 6 years ago

"Q30. How many reptile names (genus or species) contain a lowercase "o" or an uppercase "E"? Hint - you will have to combine your knowledge of regular expressions with your knowledge of logical expressions to answer this one!"

This could be asking students to use logical expression, although they have not been taught to use grepl:

grepl("o", x) | grepl("E", x)

On the other hand, this could be asking students to use regular expression "alternation", which the practical does not explain, and which in my mind differs from traditional logical expressions:

grep("(o|E)", x)  # Possibility 1
grep("[oE]", x)  # Possibility 2
EmelineFavreau commented 6 years ago

I've added an extra hint for grep

yannickwurm commented 6 years ago

we do not want to use grepl and thus the comment about 'logical expression' is misleading. They will ahve seen | and [] in class