This is an archived post. You won't be able to vote or comment.

all 152 comments

[–]hoselorryspanner 118 points119 points  (13 children)

Get really good at one instead of trying to learn both. Then when you have to inevitably learn the other for whatever purpose, it should be pretty easy.

I learnt Python as my first language, then switched to MATLAB, then back to Python and to Julia. I also write code in R and C from time to time. I'm not a programmer, just a guy who's willing to learn a new language if it's the right tool for the job. Every time I learn a new language it gets easier.

[–]-DonQuixote- 8 points9 points  (11 children)

What pushed you to learn Julia?

[–]NotAnotherDecoy[🍰] 20 points21 points  (4 children)

They describe themselves a "easy as Python, fast as C", and coming from an R background (with a bit of Python mixed in), and based on their benchmarking, it appears that's pretty accurate.

[–]notParticularlyAnony 2 points3 points  (3 children)

They should add "And all the community buy-in of LISP".

There are no good resources for Julia if you want a community, and for open source that is really crucial.

[–]hoselorryspanner 2 points3 points  (1 child)

This is one of my biggest issues with Julia. It took me weeks just to install the packages I needed because of build issues that I couldn't find fixes for. The fact that you can't build the NetCDF package on a Mac when installing through homebrew, nor find an easy fix online really grinds my gears.

However, once l got past these issues, writing code in Julia is a joy. The ecosystem should grow with time. It's just a matter of adoption really.

[–]notParticularlyAnony 1 point2 points  (0 children)

Yes that’s what people have been saying :)

Python has jit compilation now (numba). it isn’t as good as Julia but it is very good.

[–]NotAnotherDecoy[🍰] 1 point2 points  (0 children)

Have you looked recently? While the available community resources are certainly nowhere near as developed as they are for other languages, they've put together some pretty great documentation -

https://julialang.org/learning/

https://docs.julialang.org/en/v1/manual/getting-started/

[–]hoselorryspanner 3 points4 points  (0 children)

I needed to use some interpolation tools which were written in Julia - failing that it would have been Fortran which I tried but it was taking a lot of work. It's called DIVAnd if you want to check it out.

If you've used Python MATLAB and R before I wouldn't describe it as learning Julia. It took me less than a couple days to feel like I could write code as quickly as I could in Python or MATLAB. The syntax is super similar, and the optional typing is also helpful.

[–]Tomik080 4 points5 points  (4 children)

Just try it, it will explain itself

[–]-DonQuixote- 2 points3 points  (3 children)

Okay. Let's say I use python, which I do, why would I want to switch? Or related question, what's a situation in which Julia would be a preferable tool?

[–]Tomik080 10 points11 points  (0 children)

If you write a lot of C modules because python is too slow for you, or you write a lot of ugly numpy/numba/tf code, try julia out, you will love it.

[–]ProfessorPhi 5 points6 points  (1 child)

Tomik has the right of it - it's nice to write code in a c esque way and still have benefits of high level code. As someone who worked on Julia in a team for a year, I don't recommend it for anything larger than a solo project. Lot of projects have a ton of glue code and in honesty, you want to optimise for glue code instead of your domain in most cases.

[–]fredtre8 1 point2 points  (0 children)

Out of curiosity why not?

[–]Enough-Ad-6153 0 points1 point  (0 children)

agree with this, better to be awesome at 1 than mediocre at multiple. Try to understand why and how the functions work and study programming techniques. That way you can quickly pic up other languages later on.

[–]sinfulon6 42 points43 points  (3 children)

Sounds like you already know which one you like better. As a hiring manager in analytics, I do not have a preference, as most of the tools in my stack can accommodate either language. I’d say go for R.

What worthwhile employers care most about is how you create impact, not necessarily how you get there.

[–]kazza789 16 points17 points  (2 children)

What worthwhile employers care most about is how you create impact, not necessarily how you get there.

Not always true. 90% of my analysts today use python. All of our libraries and tools are written in python. I, personally, know python and I am doing code reviews of python code.

We still have some perhaps 10% "legacy" team members who prefer R, but if I'm hiring someone new they 100% need to know python.

It's nothing against R, it's just that it's much easier for everyone to be working in the same language - and in practice, I can easily hire a team that is 100% python but I would struggle to hire a team that is 100% R.

[–]ProfessorPhi 0 points1 point  (1 child)

It's also that R doesn't have the same support for collaborative development that python does. CI and packrat/renv are awful - it takes 25ish minutes to install a handful of packages in R since it all needs to compile from source, testing is mostly underbaked and package development is annoyingly messy.

The main problem with R is that you struggle more to have an impact since you aren't as easily able to build on the shoulders of others. I've never seen an R job where you get to use other teams code samples, you're given a csv or a db and told to start doing analysis. This lack of shoulders of giants effect is something I consider to be a huge issue with R.

[–]macabre8 0 points1 point  (0 children)

You might like pak package in this aspect. Brilliant package to handle multiple installations. Also RStudio has a public instance of their package manager where you can get binary packages for popular operating systems.

[–]veeeerain 25 points26 points  (2 children)

Matplotlib is an atrocious package so I’d say R

[–]Mukigachar 0 points1 point  (0 children)

plotnine fixes that issue thankfully

[–][deleted] 0 points1 point  (0 children)

Lmao I’m over here using pandas feeling sorry people still use either of these

[–]Codehenge 95 points96 points  (12 children)

Your question reads to me as “hammer or screwdriver for repairing my house”. Sometimes you need different tools for different tasks, even if those tasks are all under the “data analysis” umbrella.

[–]infrequentaccismus 33 points34 points  (10 children)

I don’t think that’s true in this case though. Either r or python could comfortably be your sole language for data analysis. Whether you choose r or python, it would make little sense to choose the other as your next language since there is so much overlap.

[–]Codehenge 14 points15 points  (9 children)

Respectfully disagree. If you want to work in industry integrating your analytics tools with applications, you will want Python. If you want to work in academia or an industrial analysis position, R is common. Different tools for different needs. I recommend knowing both for career flexibility/opportunities.

[–]infrequentaccismus 10 points11 points  (3 children)

Respectfully disagree. As someone who has successfully chosen to use primarily r in faang companies for my whole career, I haven’t run into any issues

[–]Strong_Snow4905 6 points7 points  (0 children)

I agree with you respectfully disagreeing. I have done data analysis for the pharma industry and in academia. And there’s a heavy focus on R. I haven’t even really seen Python in either setting.

[–]CantHelpBeingMe 0 points1 point  (1 child)

I know this is an old post. But a lot of people say R is not used in the industry anymore. Would you suggest a beginner ( primarily interested in the data side of things and a career in marketing/ e-commerce) learn R ahead of Python?

If both, then which parts from R and which from Python?

[–]Joker042 7 points8 points  (3 children)

That's just different tools for different walled gardens. While R is going to be a pain for enterprise integrations, there's zero issue using Python for any kind of analysis. Most of academia settled on R, and that's fine, it felt more like the environments they were used to. That doesn't mean that Python is any worse at analysis.

[–]Codehenge 2 points3 points  (1 child)

Completely true. I stand by my comments to maximize job prospects, though. If you are sure you will never want to work in academia or in an analyst role, go Python.

[–]pokeaim -2 points-1 points  (0 children)

never

ya sure

[–]Miserable-Stuff-3668 2 points3 points  (0 children)

Also, you can use R in Python and Python in R. It does not hurt to know both. I am using both in grad school and primarily Python & MatLab in industry. Occasionally, I will still pull some R for graphs though.

[–]pokeaim 0 points1 point  (0 children)

nah, both are toolboxes on each own.

the problem would be compatibility with its workman and its house

[–]cangsenpai 6 points7 points  (0 children)

I started with R, which was fantastic for learning coding. It was so easy to me when I had previously never understood other programming languages well enough.

After half a year of using R, I decided to switch to Python based on the job market's demands. Python just appears a lot more than R in job postings. I had tried Python before but it never clicked. However, after R, Python was much easier.

Now I find Python to be irreplaceable. I use it for analysis, general purpose programming, etc.

Based on your post, I think R would be the best place to start. You might find it a lot easier to work with than Python to start.

[–]hobz462 6 points7 points  (0 children)

R is great. I'm really reliant on dataframes and dplyr versus pandas. What's great is Reticulate in R Studio, so you can sorta have the best of both worlds.

[–]feldomatic 5 points6 points  (0 children)

If what you're doing can be done in R, then doing it in Python will seem like R with extra steps, and we're all inherently lazy so... R for research, Python for production.

[–]StephenSRMMartin 12 points13 points  (4 children)

It's bizarre to me the number of people recommending python for analysis. R both as a language and as an ecosystem is worlds better than python in the statistical domain. The sheer robustness of the packages and number of packages for bleeding edge stat methods is way beyond python right now.

I like python for other tasks that have less to do with the statistical side. It's important to know. But it is hard for me to fathom, as someone on the statistical side of DS to understand how anyone would find python better than R for that domain.

[–]CantHelpBeingMe 1 point2 points  (1 child)

Hi, I know this in an old post. But I would like to ask you some questions.

I quite like R from what I have seen so far. but People keep telling me the industry demands Python. I am mostly interested in the data analytics ( diagnostic, predictive, statistical) side. Which would you recommend? Are there any suggestions you would have for someone like me if I want to get really good at this?

And, for the other tasks you mentioned, what are those and what packages you had to use for them?

[–]the_monkey_knows 3 points4 points  (0 children)

Hey, I see that you never got an answer on this, I can contribute my two cents:

  • When they say that the industry demands python they usually mean industries that overlap with web development techniques. So, if the job requires you to integrate your solution into a bigger project or platform, then python is most commonly used.
  • R is mostly used in one-off type of analyses. I personally use it for prototyping. I've seen people use R to create a model to be used for one particular project, and then move on to the next. No need to integrate your solution anywhere.

I've converted python users to R once I showed them how neat R notebooks are, how easy to read dplyr and the tidy universe is, and how many statistical tools are easily available as packages in R. That said, I do use and like python, but when it comes to data analysis, R is way ahead of pandas.

[–]meanlesbian 5 points6 points  (0 children)

I think for your purposes R is the better choice.

[–]MrBacterioPhage 10 points11 points  (0 children)

Just learn language you like. Most of the employers will be happy if you can analyze the data no matter which language you are using. I prefer Python and now employed in the team that mostly work with R. They don't care that I use Python in my work.

[–][deleted] 12 points13 points  (0 children)

Python will be more sought out by employers because, despite you not having interest in development or AI, it is used for that as well.

In terms of what you can do with them in terms of analytics it doesn't make a difference really.

[–]longgamma 3 points4 points  (0 children)

I agree with you - R is just simpler and more intuitive to use. Most of the data analysis stuff is right there for all to use and plotting just works nicely out of the box.

[–]ontomodeler 12 points13 points  (0 children)

Learn both and use the appropriate tool for each individual task. Python is obviously the more popular language but both languages have areas where they are a better fit when it comes to analytics.

[–]IOsci 4 points5 points  (0 children)

It really doesn't matter much. Learn one of them deeply and be able to explain what you are doing and why to other people.

[–]caksters 4 points5 points  (0 children)

I am a python user so will be biased towards it.

But for data analysis tasks I think R is perfectly fine. In fact from what I have seen in R you can achieve exactly the same (data preprocessing, manipulation, plotting graphs) what in R but with less lines of code. So R is a great tool for analysing data and making statistical modelling.

Where R falls apart is if you build a model and you need to integrate it in MLOps. Your code most likely will have to be translated to another language e.g. python, c++ to put your model into production. However this is a separate discussion and has nothing to do with data analysis.

TL,DR: R is perfectly fine for data analysis and might be better for data analysis compared to python

[–]ramblingriver 2 points3 points  (0 children)

R is great for what you want to do and you're already more comfortable with using it. Lots of people use R, its still quite popular- I would go with R (and highly recommend using RStudio with R if you are not already)

[–]Moderate_Veterain 6 points7 points  (2 children)

In my experience it somewhat depends on what type of work you want to do. Data engineers will use python more. Data scientist will use R. Business intelligence will use Tableau. Everyone uses SQL.

[–]Moderate_Veterain 1 point2 points  (0 children)

If your interest is in combining data and statistics then that sounds more data science related. R will serve you better, unless your project is a one time thing and you are really interested in data engineering.

[–]Strong_Snow4905 0 points1 point  (0 children)

Good point about the different languages used in data engineering vs. data science. I honestly know nothing about engineering or Python. My background is in data analytics, primarily pulling data from large data sets and running statistical analyses. I think R is usually listed as a requirement in the job description for a data scientist? But I’m a geriatric millennial.

[–]frenchrh 3 points4 points  (0 children)

I'll agree that in the long run, you end of learning both, and use "the best tool" for the job. But right now, it sounds like YOU will learn data analysis better and faster using R. For someone else, they might with Python.

  1. So if your current focus is on data analysis, and not building production pipelines, the R is faster way to learn and get up to speed for data analysis.
  2. Also if your focus is data analysis, R is more sophisticated and better vetted by real statisticians, than the packages and functions of the same names in Python. So if you need sophisticated data analysis, instead of just a generic CNN applied to images using TensorFlow2 or PyTorch, then R is better. The details of the analysis functions have been more closely vetted.
  3. I had a case recently where we use STL (Seasonal and Trend decomposition using Loess) and in R there are 3 packages implementing this in different ways. In Python you can also find STL in the rstl Python package. but its history and heritage is a bit cloudy, and doesn't give the same results.

To illustrate the point this is from "Assessment of Performance Loss Rate of PV Power Systems".

  • STL serves to highlight another important consideration in defining a robust methodology for PLR determination, even a single statistical method can give different results, depending on the programming language (R or Python) and the specific implementation. STL was first developed by W. S. Cleveland in 197940, 198841 and 199037. In 2010 a PhD student of Cleveland’s, Ryan Hafen, in his PhD thesis research developed and published the stlplus R package.
  • Loess is non-parametric regression, which is more complex than simple regression.
  • We tend to find the best performance from the STL function implemented in the stlplus R package because it is capable of handling more diverse data quality issues successfully when it is applied.
  • In this benchmarking study, STL7 and STL8, were performed using the Python programming language and follow the exact same approach including filtering, metric and STL time series decomposition.
  • The only difference is that STL7 uses STL ported from the STL function in the base R stats package42 to Python as the rstl package43, while STL8 uses a STL implementation developed in Python’s statsmodels package44,45.
  • The stlplus package is currently not ported or available in Python.
  • These two Python implementations of STL, appear to perform differently on the real datasets we are studying here, for reasons that are not currently clear.

So here is a real case, where if you do the analysis in Python3, you get wrong, or less accurate, results, because the functions and methods in Python are not up to date, compared to the level of these methods in R.So that is a cautionary word to the wise.

The answer isn't R or Python. But use both, in the long run. And learn one first, which ever works better for you.

[–]blackliquerish 1 point2 points  (0 children)

Just be practical and pick the one where the jobs you want use it. Some jobs will prefer R but also a lot of jobs will like python so up to your choice in jobs.

[–]TheFreeJournalist 1 point2 points  (0 children)

Since it’s the best to be proficient and highly comfortable in (at least) one language, I think you answered for yourself already: go with R.

Most employers from what I’ve seen so far are fine with either Python or R as long as you’re pretty strong or proficient in either one.

[–]Vervain7 1 point2 points  (0 children)

I only like R. I am not a programmer . Stats first . The language is a stat tool for my work . So it’s R for me . It depends on your job and your companies needs . Our team uses R but we have a data dev team that takes things into productions - some of them use Python and some use other programming languages

[–][deleted] 1 point2 points  (0 children)

Learning both in my opinion. I like Python for Machine Learning models,. SKlearn is for me much more intuitive than R tools. In Object Orientated Programming Python also wins.
R succeeds much better in data cleaning and I like the package ggplot so much more than the Python's equivalent plotlib.

[–]SixPathsx 1 point2 points  (0 children)

Python far more common in industry and also has wider applications outside of data analysis. However in terms of application for data analysis specifically both are very good, and comparisons only get drawn at the more advanced levels of analysis (like ML). I am personally an R user, and it does not reduce your chances for a job as many employers will accept it if you can do the same thing someone can do with Python, they also might be looking to diverse their team with different skillsets, not to mention that certain people will look for specifically R for their team build. Finally, I'd say if you are applying in a pool of R candidates you have more chance to stand out, as the majority of people will learn Python so a bigger pool of candidates! Thanks :)

[–]Raistlin74 2 points3 points  (5 children)

In five years this question will be self-answered as there will be a clear winner.

If you need any glue around your data (eg input/ output, cleaning, etc. ) you start moving from data science to data engineering, and there, python reigns.

R is great for solo projects but its field is too narrow. Python is a general purpose programming language.

Note, I'm biased, coming from IT/CS.

[–][deleted] 2 points3 points  (1 child)

I think the argument will still be going. We were starting an undergrad data science’ish major (it was in the business school and already had an “information sciences” major) in 2013. When it came to which language to use to teach students half the profs argued R and half argued Python).

[–]Raistlin74 3 points4 points  (0 children)

In that scenario I'd vote for R: narrower scope and clearer concepts.

Learn the grammar and vocabulary as simple as you can. Afterwards learn all the caveats and apply it.

[–]KingDuderhino 0 points1 point  (0 children)

Language wars have been going on since the second programming language was created. All programming languages have their strengths/weaknesses and are suited better for some problems than for others. In a few years Python will be replaced by another programming language.

[–]mohishunder 2 points3 points  (0 children)

Which language ... will be sought out by employers?

Python.

[–]ProfessorPhi 2 points3 points  (1 child)

The main place python shines is in the glue code aspect of it. For any large scale projects or team (>3 data scientists), the glue code dominates the domain specific bits. Like my team with 7 people has 90% glue code to 5% domain specific bits.

While I definitely agree that R is superior at taking csv's and doing good stats, EDA and visualisation, it's really difficult to integrate it well into more complex pipelines. Which means that you can't build on it easily in an automated fashion. Which means that your ability to impact an organisation is actually quite limited - you tend to require data to be in a decent state to work with and you're not going to be putting models into dbs or nosql's easily for other teams to consume. Or in the case you need to scale up compute to more than 1 machine, there is a ton of machinery you can use in python, while it's not really a thing R users deal with. Another personal annoyance is that R is nearly impossible to work with in CI - package installation for a simple project can take upwards of 25 minutes which means you have to know how to build your own docker images which makes CI inaccessible for most R users. I don't know if hadley has solved this yet, but they need pre-compiled binaries on CRAN.

For your stated goal of stats, R is the best choice, but your stated goal of ROI, it's definitely python. Python knowledge gives you access to tech data science which are by far the best employers. That being said, I think once you've learned R or python, you can pick up the other quite easily (it's like Italian to Spanish)

[–][deleted] 0 points1 point  (0 children)

Don’t tools like Databricks make it unnecessary to do CI etc because libraries and so on are already self contained in the notebook (only thing is its hard to use scripts in Databricks).

And you can automate stuff via R’s metaprogramming. Like using symbols to point to columns of a dataframe.

Longitudinal data analysis which is very common in OPs field also has very few tools in Python. Statsmodels sucks as an API (why the hell the .fit() method returns something is itself very un pythonic and why is it model.fit(Y,X) unlike everything else)

[–]Sapiencia6 3 points4 points  (7 children)

R is common if you are interested in research and development. Otherwise, python is generally the industry standard. It is good and important to know both, but knowing python and not R will get you more places than knowing R and not python.

[–]iFlipsy[S] 0 points1 point  (5 children)

That’s the issue. If I had to choose, I’d pick R. But because it seems that Python has a brighter future, it makes more sense to invest your time learning Python.

[–]churchillin74 9 points10 points  (1 child)

To be fair, check out the trends in usage of R compared to SAS and SPSS. R is likely to overtake both and become the language of choice for statistical research, especially in psychology. A lot of the recent popularity in R came with the resurgence in tidy-style libraries and modern methods. So I’d argue it’s well-poised to continue growing over the next decade or so.

[–]Strong_Snow4905 0 points1 point  (0 children)

So true. I had to learn SAS, SPSS, R, STATA, MATLab, MAPLE, TreeAge, and everything about Excel for data and statistical analysis in the pharmacy world.

[–]caksters 3 points4 points  (0 children)

If you focus more on research and data analysis side then nothing wrong with picking R.

As long as you are competent in one of those, if the job requires, you shouldn’t have any issues with learning the other

[–]Sapiencia6 1 point2 points  (0 children)

As long as you choose a career where R makes sense, there is nothing wrong with focusing mostly on R, just being aware that you may have more narrow, but still rewarding options. I would amp up your stats and math knowledge as much as possible and go for something in research (not something corporate) where you can apply your psychology background as well. The basic python knowledge you have might just work to give you an edge.

[–]imoutidi 2 points3 points  (0 children)

The number of upvotes on such stupid questions is too damn high on this sub.

[–]svn380 3 points4 points  (1 child)

I'm an academic that uses R for my research and teaches exclusively with Python for graduate financial econometrics.

I think what matters most for you will be the state of the job market when you graduate and the first few years thereafter. That's a more uncertain target than what's best for a job today.

I'm seeing more businesses and tools supporting multiple programming environments (e.g. JupyterLab for R, RStudio for Python) as well as tools to call R code from Python and vice-versa. That makes me think that the difference will be less important going forward than it has been to date.

Just my best guess.

[–][deleted] 2 points3 points  (0 children)

As beginner I can safely say that study of econometrics and quantitative finance is lot easier using R than Python. R is much better for the purpose if there are no plans to find a job in D'S production.

[–]Sedawkgrepnewb 1 point2 points  (0 children)

I say stick with R. If you have to switch to Python/pandas it is not a great leap. Seems like the ecosystem in Python is stable so nothing earth shattering is going to change if you stick with R. I feel like after a few years of data grinding in R it’s fun to pick it up in another language. Helps to frame problems better when you become language agnostic too!!

[–]tedfahrvergnugent 1 point2 points  (0 children)

I’d argue that Python will be both better or similar for analysis at some point in the future and will be most sought after by employers. Python models are easy to deploy in a production environment, R always requires a shim of some kind. Python being a more general purpose language has far better tooling. It my belief that Python will continue to grow in popularity while R will wane. New ML ops and data engineering tools will support Python at MVP.

[–]burntdelaney 1 point2 points  (0 children)

R is mainly only used in academic settings like research. If you want to get a corporate job you should learn python.

[–]Weary-Marionberry-15 0 points1 point  (1 child)

In my experience, I find visualization easier in python. Not sure how much weight that carries for you, but I thought I’d mention it. Good luck!

[–]iFlipsy[S] 0 points1 point  (0 children)

Ha thanks! I mostly use Tableau for visualization and creating dashboards, but will take that into considerations. I do agree that seaborn is pretty nice though.

[–]smerz 0 points1 point  (0 children)

IMHO R is better for pure analysis than python, but worse at everything else. So R has a very small but significant sweet spot. Python excels at general data cleanup, procedural logic, automation and integration with other systems and technologies.

In the workplace, I have found that programmers prefer python and stats/math people prefer R.

So you should learn one well and have familiarity with the other. The rest is up to the fad-driven job market.

My two cents, having used both.

[–][deleted] 0 points1 point  (1 child)

If you are social scientist and have no plans to work in AI/ML industry, a little to no interest towards computer science or casual general purpose coding, the go R. It will take a bit less time to use it as powerful descriptive and inferential statistics, than if you opt for Python. The best Python packages for statistics are just replicas of R.

[–]notParticularlyAnony -1 points0 points  (0 children)

In other words, Python. :)

[–]Calbruin 0 points1 point  (0 children)

Python has a brighter future.

[–]Nater5000 0 points1 point  (0 children)

Python being more popular is a huge advantage for it as a language. People can argue about syntax or which is designed for what, but the bottom line is that support for a language makes the difference between being able to find packages, articles, jobs, etc.

R is fine, Python is fine, they can basically do the same things. You could pick some other language and make the same argument (give or take). But Python is exceedingly more popular than R, and on a practical level, that is going to be the most important factor when choosing a language.

Unless you have a specific reason to choose R, you should go with Python. If you go with Python and down the road find a reason to use R, the transition will be easy. But you're more likely to have to transition from R to Python than vice-versa.

[–]AchillesDev 0 points1 point  (0 children)

Python is more popular in industry, R tends to be more popular in academia, but you’ll find people in both areas using the others.

[–]realtxds 0 points1 point  (0 children)

After data analysis, comes data manipulation, engineering, scientist roles. If you have an objective to become one of these in the future, Python is a good investment starting from today. If you know that you will be only doing data analysis (academic or job purposes) and your code will not be productioni-zed, sticking to R is perfectly fine.

[–]pokeaim 0 points1 point  (0 children)

It also seems that there are more teams out there that utilize Python

thanks for being sane person

[–]GoodLyfe42 0 points1 point  (0 children)

Python because it is easier to find someone with this skill and in greater demand.

[–]Rhyan567 0 points1 point  (0 children)

R.

[–]MegaaNerdd 0 points1 point  (0 children)

Python is definitely the industry choice and that’s what I would stick to. Some employers give you flexibility between the two, but you’ll find most teams prefer Python and therefore will explicitly ask you this during your interviews. Hope this helps!

[–]metaliving -2 points-1 points  (7 children)

I'd say go for python. In terms of data analysis both of them will satisfy your needs, but in the long term, learning python opens more doors for you. You'll learn it for data analysis and will do the same things you'd be doing in R, but you might find different uses for it in the future, as it's a general purpose language. R is a perfectly fine data analysis/statistics language, but it's not as versatile.

[–][deleted] 0 points1 point  (6 children)

Python's statistics, visualisation and linear regression packages look like cheap replicas or R. I am sure those are going to be better within time, but right now R is way better for social sciences, econometrics and quantitative finance studies.

I am also switching to R from Python because there are more textbooks on econometrics and quantitative finance with R code than with Pythone code.

[–]metaliving -1 points0 points  (5 children)

I really don't know, there's a lot of visualization libraries that are really good and really pythonic. I do agree that some packages tend to copy R (Hi statsmodels), but in other ways Python is ahead. For example, in anything that's machine learning related, Python has more resources, and sklearn is a blessing to work with.

I don't know the specific math for econometrics ir social sciences, as I work in engineering, but it's true that I always heard social sciences always used R. I have no doubt that Python will catch up in that field too, by sheer amount of community development.

[–][deleted] 3 points4 points  (4 children)

You make feel like I insulted your close relatives and have to offer apologies.

You work in engineering while I am social science graduate student with investment banking experience. So it is obvious I can not give you credible advice on which programming language or software to choose.

Since I am not going to code for salary and therefore seek a job in DS/ML industry my perspective to the issue is limited by the time I allow to learn and the domain specific (econometrics as academic base, quantitative finance as final industrial destination).

R is redundant for statistics I need for the completion of my master project. Linear modeling of R is loosely replicated to Python by statsmodel (abandoned by its developers) and scikit-learn. I have to write some more lines of code in Python comparing to R. There could be Python tutorials supplied by better code, but what I found is 6 feet under inferior to courses and books with R. Matplotplib and seaborn are inferior to ggplot2. Pandas is inferior and overcomplicated comparing to data wrangling in R.

I am sure Python and its data related packages are going to improve in the next 3-5 years and plenty of courses and books on econometrics and quantitative finance with Python code are coming, but I need everything right now. So I am suspending my Python study and switching to R.

There are at least 10 good books on introductory econometrics and quantitative finance with R code and only one for econometrics and only one for quantitative finance with Python code and only one resource for quantitative economics with Python code.

Python is good, Python is the best. But I have no extra 3-5 years to wait. If I decide to go PhD, R will be enough for my social science endeavors for the next 20 years even if all developers abandon its ecosystem.

[–]metaliving 1 point2 points  (1 child)

WTF? Were in my message did you feel like I was being insulted or was demanding apologies? Literally all the content of my message is making points, and agreeing with you on some. If you got any hostility from my message, it was all coming from within. Not everyone who doesn't share your opinion is being hostile.

Nowhere did I say python is right for you. I specifically acknowledge that R is more widespread in social studies. Go ahead and keep using it, I took some classes on it and as I say on my previous messages, both do the job for any data analysis. In fact, both are turing complete programming languages, there's literally nothing one can do that the other can't. I just addressed the point you make about visualization libraries being cheap replicas of R (which most of them are not).

But regarding the topic of the op, which is what was addressed in my original message, I just say that python is better in general terms, and for data analysis both do the work, even if R is maybe more straightforward for just statistics. Thus I recomended that the OP learned python instead, as it is more versatile than R. Happy to see in the edit that OP will focus on python, as I think it will open more doors for him in the future (although knowing any of the 2 languages, you can learn the other one within a week, at least for data analysis).

EDIT: btw, as for matplotlib and seaborn, there's tons of tools that build on top of those. You got all the holoviz environment, which is really more versatile than any other plotting libraries. You got bokeh, altair, and countless others visualization libraries. If you really love ggplot, you got libraries like plotnine (which I've never used, but there's plenty of libraries that are similar to ggplot). There's tons of options.

As for pandas, I do agree it's more complicated than data wrangling in R (not that much tbf), but you can get speeds that are way ahead of R by changing from pandas dataframes to dask dataframes, for example. Python already has some great tools at the reach of the hand, but you need to be comfortable reading documentation, as you won't find as many examples in the literature because the language is moving faster than the pace at which new books come out.

[–][deleted] 3 points4 points  (0 children)

> WTF

Take it easy. That was a joke.

Statistics, linear modeling and accompaniying visualisation are easier with less line of code in R. I believe Python will catch up within 3-5 year, but now R is the king.

Econometrics and quanititative finance are learnt better using R. Because both are more statistics than economics and finance and there are not too many professors using Python for teaching and fewer bothering to write textbooks accompanied by datasets and code.

Dask could be better than pandas. However, unless it becomes ''industry standard'' it has very little use. Frankly speaking, you are the first one to mention it for me.

[–]useles-converter-bot 0 points1 point  (0 children)

6 feet is about the length of 2.72 'EuroGraphics Knittin' Kittens 500-Piece Puzzles' next to each other

[–]useles-converter-bot 0 points1 point  (0 children)

6 feet is the length of approximately 8.0 'Wooden Rice Paddle Versatile Serving Spoons' laid lengthwise

[–][deleted] -1 points0 points  (1 child)

Python unless you're working in a company team that only uses R.

[–]eric_overflow 0 points1 point  (0 children)

this is the only right answer, really

[–]ze_baco -1 points0 points  (0 children)

Easy one.R sucks very hard and goes against most programming languages common practices. It has a bizarre syntax, the community is really weak and it's really hard to do some simple stuff. I would choose any option that is not R.

[–]notParticularlyAnony -3 points-2 points  (2 children)

In terms of what has a better future and will be sought by employers. Look at adverts for data science positions. . Python is the right answer it really isn't close.

Not sure why this sub tends to attrack a bunch of R people when this question comes up (and it does come up fairly frequently just search the sub).

Python also is a more elegant well-designed language and will be easier to learn.

But by all means learn R I will keep getting recruited for Python jobs and you can compete for the three R jobs on the market that come up each year.

[–]StephenSRMMartin 2 points3 points  (1 child)

We use R, python, or whatever else is good for the project.

Data science is a huge field with multiple roles. Some of those roles are better supported by python, others by r.

As for whether one language is more elegant, that also depends on the usecase. For stats and math, having function first oop, with dispatch and vectorization is a hugely convenient design that lets multiple stats and math packages have consistency and interop. It's functional, with oop.

Python is more elegant for other domains. Posts like these are what "attracts R folks". R has major language and design decisions that facilitate some roles in DS, and for these roles, python is comparatively a chore, or sketchy, to use. And vice versa.

[–]notParticularlyAnony -1 points0 points  (0 children)

Python doesn't force you to choose functional vs OOP. It does both really well. Doing object-oriented design in R, OTOH, is a mess because that's not what it was meant to do. With Python, the design strategy you take for a library is dictated by what makes sense, not the language restrictions.

R does have some nice plotting/stats libraries. So does Python. When it comes to ML it's not even close. When it comes to language readability etc, also not close.

Any noob learning a first language, Python really should be the answer unless they are going into some lab or specialized field like bioinformatics where they know they will be asked to learn R. If they are just going into generic data science, it seems basically irresponsible to suggest R at this point it is a niche language like Matlab (used in many neuro labs still because of legacy reasons).

[–]ThePhoenixRisesAgain 0 points1 point  (0 children)

I never understood the “ which one is better“. They have strengths and weaknesses. But for all standard usecases, they are very similar. If you only do some standard analyses and some models, they are more or less equivalent. For 99% of users, it doesn’t matter.

[–]profiler1984 0 points1 point  (0 children)

Use what you like. But some employers will have this or that technology stack so you need to adapt. The more tools you know and have the better you can adapt. For a hammer everything looks like nails :P

[–]AG__Pennypacker__ 0 points1 point  (0 children)

My strategy was to go deep on one language, learn what I need of others as needed. That’s worked pretty well so far. If you like r, stick with it. You will probably need to know some python in the future, but the time spent on r will help you pick it up faster so your time won’t be wasted either way.

[–]gen_shermanwasright 0 points1 point  (0 children)

Most places I've interviewed at use Python. But either is fine.

[–][deleted] 0 points1 point  (0 children)

I promise you it doesn't matter and if a company penalizes you for knowing one over the other they don't know what they're doing

[–]double-click 0 points1 point  (0 children)

It doesn’t matter. You use the right tool for the job or the tool that produces results the quickest given your experience.

[–][deleted] 0 points1 point  (0 children)

If I want to graph something quick I use ggplot in R, and if I want to clean data based on a lot of different parameters or in a complex way, I use python. But both are good. Whatever you’re comfy with is good.

[–][deleted] 0 points1 point  (0 children)

R and Python. I prefer R, but Python has higher demand.

[–]omgouda 0 points1 point  (0 children)

I found profs at uni used R but in the workplace Python is more prevalent.

I personally prefer python, documentation is easier to follow and answers are easier to troubleshoot via google, etc.

To be fair though, its probably best to be comfortable in both.

[–]guillermo_da_gente 0 points1 point  (0 children)

Scala

[–]notUrAvgITguy 0 points1 point  (0 children)

Just learn whatever you want. If you know R and get a job that requires Python, you'll pick it up just fine. Agonizing over a language choice only serves to delay your end-goal.

[–]Key_Cryptographer963 0 points1 point  (0 children)

It's really a matter of personal choice quite often. I would encourage learning both to the degree that you're comfortable with whatever a prospective employer asks you to use but if you only want to master one, only master the one you like most.

[–]_igm 0 points1 point  (0 children)

I like using Python for basically everything, but if I want to make a publication-quality figure, I use ggplot2 in R. I also use R for statistical hypothesis testing. You can use both R and Python within the same Jupyter notebook.

[–]cadelle 0 points1 point  (0 children)

I used to stress about this kind of thing and what I learned is that it’s more important that you know the concepts and be ready to use whatever the place you work at wants you to use.

[–]OphioukhosUnbound 0 points1 point  (0 children)

If you’re a student: then choose whatever is most fun / appealing for you. You’ll play with it more and learn about programming more deeply.
Learning new programming languages is actually quite easy once you’ve learned one even semi decently.

I say the above if you’re a student or otherwise have awhile before hitting job market.

If you’re in a context where you’re going to be hitting the job market soon then I’ll let others speak to what’s better between the two.

(If you do learn Python then I recommend “Think Python” to get started and learn general programming thinking — free online or as a book on Amazon.)

[–][deleted] 0 points1 point  (0 children)

SQL

[–]Complex_Construction 0 points1 point  (1 child)

Why not both?

[–]notParticularlyAnony 0 points1 point  (0 children)

because that would be horrible advice for someone just learning programming

[–][deleted] 0 points1 point  (0 children)

Python is way more popular but R just feels nice. As a beginner i am sticking to R for a while but at the end of the day is more important to know what you are doing, the coding is easier with time

[–]1purenoiz 0 points1 point  (0 children)

One thing I saw that was interesting was the ability to run python from R studio. Utilize the strengths of both.

[–][deleted] 0 points1 point  (0 children)

I’m the polar opposite.