Exercise

# Calculating Valuation Multiples

Using the Pharmaceuitcal firms you have identified in the prior exercise (the data of which is stored in the `pharma`

data object), calculate the P/LTM EPS, P/NTM EPS, and P/BVPS for the comparable companies. P is the market price of the stock, EPS is earnings per share, and BVPS is book value of equity per share.

Note that, in practice, there are times when the EPS or BVPS is not populated from the commonly used databases. Therefore, you have to make sure your code is adequately flexible to only calculate multiples when the EPS or BVPS is positive. If the EPS or BVPS is not positive (i.e., less than or equal to 0), your code should set the value of that multiple equal to NA.

For this exercise, you should use the `ifelse()`

argument to set non-positive values equal to `NA`

. Otherwise, for positive values, we can calculate the valuation multiple.

Instructions

**100 XP**

- Calculate P/LTM EPS.
- Calculate P/NTM EPS.
- Calculate P/BVPS.