jeudi 29 novembre 2018

ifelse value specified amount less than other value then

Apologies all, I'm new to R and am stumped on something that I am sure is simple!

I have this working code: lr5yr$"LR_3Y_>10%_over_5Y" <- ifelse(lr5yr$lr >= 0.65 & lr5yr$lr - lr5yr$lr5 < lr5yr$lr ,"Y","N")

Effectively all I need is at the end to specify how much less the final calculation is.

In my formula the end is show a Y if the value of lr-lr5 is less than lr. But what I need is for it to show a Y only if the amount less is greater than or equal to 0.1

So, if lr-lr5 is 0.1 or greater less than lr show Y.

Aucun commentaire:

Enregistrer un commentaire