Use R for prototyping and C/C++ for fast implementation; those are the only languages you should ever need. Python is nice but ultimately its a software development language, while as an academic your interests are more likely to be data analysis and algorithm implementation. R blows aways numpy/scipy by pretty much every standard going.
Best programming language to learn?

R is a terrible scripting language, slow and poorly implemented. The fact that everyone uses it does not make it something you should learn. It rode the wave of opensource, and now everyone is stuck in an inefficient equilibrium with a poorly designed engine and terrible syntax.
Use R for prototyping and C/C++ for fast implementation; those are the only languages you should ever need. Python is nice but ultimately its a software development language, while as an academic your interests are more likely to be data analysis and algorithm implementation. R blows aways numpy/scipy by pretty much every standard going.

No, R is a good scripting language with very clean schemestyle semantics and much better support for functional programming than python has.R is a terrible scripting language, slow and poorly implemented. The fact that everyone uses it does not make it something you should learn. It rode the wave of opensource, and now everyone is stuck in an inefficient equilibrium with a poorly designed engine and terrible syntax.

if and egen in Stata is very efficient in dealing with data, but what is the corresponding device in R? It looks like I have to rely on a lot of nested device to subset the data.
replace y=z+1 if x==6
becomes
y[x==6]<z[x==6]+1
looks a lot longer and weird.why is R bad at "cleaning data"?

It's actually shorter in Russia the way you wrote it... State is horribly inefficient and gives you no flexibility in terms of data structure. If all you are ever dealing is one dataset with no dependence between observations then it's ok but becomes a nightmare for anything a bit more complicated
if and egen in Stata is very efficient in dealing with data, but what is the corresponding device in R? It looks like I have to rely on a lot of nested device to subset the data.
replace y=z+1 if x==6
becomes
y[x==6]<z[x==6]+1
looks a lot longer and weird.
why is R bad at "cleaning data"?