Due to design differences you can’t compile various libraries or frameworks for R or Python locally - like you can on macOS - when these packages are not available. Apple additionally limits loading of binary code from within an already installed app.
Decent local Python environments on iPadOS are
Carnets (free) or
Juno - the basic stuff is covered.
AFAIK there is no uptodate R app with a functional GUI on iOS/iPadOS. I have compiled R in iSH, including some libraries like dplyr, as webasm, but that is somewhat tedious and gives you just a terminal based, quite limited “plain” version of R.
You can - as others already pointed out - access/remotely use R e.g. via
posit.cloud (various tiers incl. a free one).
Google Colab offers access to/remote usage of R and Python.
IMHO a Macbook represents the more appropriate and much better choice for data science.