每次 col X 中的数字增加 24 时,col Y 中的数字增加 1

Increase numbers in col Y by 1 every time numbers in col X increases by 24

每当我的 X 列再增加 24 时,我想将 Y 列中的变量增加 1。我已经在下面的 Y 列中显示了我试图创建的输出。

x<-c(5,10,15,20,25,27,29,42,47,49,50,60)
y<-c(1,1,1,1,2,2,2,2,2,3,3,3)
df<-data.frame(x,y)

答案是

floor(df$x/24) + 1