Menu

Create data…

Given that an A equals to 4, a B equals to 3 and so on, we can use ifelse()  to extract a numeric grade as follows…

How ifelse()  commands works is very straightforward. The first argument is the logical test, the second argument if the value if true, the third argument if value if false. For example, ifelse(Grade == A, 4  means if Grade equals to A, then the value if 4. As you can see, the third argument is another ifelse()  to test if the grade is a B and so on.