Hello everybody,
I have data like that. I would like to calculate the breakpoints at 30% and 70% for variable "BTM" each year.
I tried this code but this code has an error. I would like to ask for help. Thank you in advance.
df<-data.frame(
yyyy = c(2000L,2000L,2001L,2001L,2001L,2001L,
2001L,2001L,2002L,2002L),
BTM = c(4.99137e+21,3.352767396e+21,
5.26505365887288e+21,2.09113916730247e+21,4.23970980946175e+20,
8.061477105e+21,3.378213072e+21,1.52745289670368e+20,
2.89211394115133e+21,1.00022139200115e+21),
ticker = as.factor(c("REE","SAM","BBC",
"CAN","LAF","REE","SAM","SGH","BBC","BPC")),
code = as.factor(c("REE2000","SAM2000",
"BBC2001","CAN2001","LAF2001","REE2001","SAM2001",
"SGH2001","BBC2002","BPC2002"))
My code
percentile<- df%>% group_by(yyyy) %>%
quantile(BTM,probs = c(0.3, 0.7),na.rm=TRUE)
Best regards,