# In survival analysis, how to calculate power from hazard ratio and number of events given alpha?

If I know number of events and hazard ratio, with given alpha, how do I calculate the power?

z<-0.5*sqrt(n)*log(1/hr)-qnorm(1-alpha/2) power<-pnorm(z)