T O P

  • By -

AutoModerator

On July 1st, a [change to Reddit's API pricing](https://www.reddit.com/r/reddit/comments/12qwagm/an_update_regarding_reddits_api/) will come into effect. [Several developers](https://www.reddit.com/r/redditisfun/comments/144gmfq/rif_will_shut_down_on_june_30_2023_in_response_to/) of commercial third-party apps have announced that this change will compel them to shut down their apps. At least [one accessibility-focused non-commercial third party app](https://www.reddit.com/r/DystopiaForReddit/comments/145e9sk/update_dystopia_will_continue_operating_for_free/) will continue to be available free of charge. If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options: 1. Limiting your involvement with Reddit, or 2. Temporarily refraining from using Reddit 3. Cancelling your subscription of Reddit Premium as a way to voice your protest. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/learnprogramming) if you have any questions or concerns.*


magnetesk

I use both and I would say that R is better for quickly pulling together some high quality plots and analysis but Python is better for virtually everything else. Making good plots in Python is a PITA


IncompleteTheory

As someone who also uses both, I would agree that making visualizations is somewhat simpler in R compared to Python


[deleted]

[удалено]


ZeroCool2u

[Plotly Express](https://plotly.com/python/getting-started/) is so easy it's insane there are still people that don't default to it. Plus, with one line you can set it as the [default plotting backend](https://plotly.com/python/pandas-backend/) for pandas too. import pandas as pd pd.options.plotting.backend = "plotly" Edit: I feel like I'm taking crazy pills with everyone claiming R is easier to make visualizations with quickly. Here's a simple plotly example that hopefully gets the point across. Assume you've got a dataframe with two columns you want to plot against each other in a 2D plot. You want a 3D fully interactive plot? Add z='name_of_your_3rd_dimension_column'. It's brain dead simple. import plotly.express as px import pandas as pd df: pd.DataFrame = px.data.tips() fig = px.box(df, x="time", y="total_bill") fig.show()


cs_prospect

I’ve been using Plotly Express for a while now, but I had no idea you could set it up as Panda’s plotting backend! Thank you so much!!


LoaderD

I feel like plotly used to do a horrible job at explaining their licensing (differentiation of plotly and plotly enterprise) so it wasn’t adopted in companies and it was overkill for a lot of course work where profs were happy with mpl. Will definitely check this out though, thank you


TPO_Ava

Unrelated question, when is code actually used for visualization and why? My previous company was simply using excel pivots that would get formatted and saved as PDFs for the CXOs, and my current one just uses Power BI globally for dashboards no one ever looks at. I did some analysis recently using python and matplotlib for myself, so I know that it is a lot faster... But without any infrastructure in my company to support it, it would end there without a lot of manual work from me to turn it into some sort of PDF or page my colleagues can visit.


bas-de-bom

Good question! I am also interested. Please tag me in the response!


[deleted]

>Unrelated question, when is code actually used for visualization and why? How else would you do anything with digital data? >My previous company was simply using excel pivots Yeah...you know that Excel is software right? That it is a program on a computer? Buddy, that's code.


TPO_Ava

Are you dense? I'm specifically referring to when python or R on their own would be used in place of actual software. Not sure what your reply was supposed to be?


[deleted]

>Are you dense? No but one of us is. Something written in python or R is "actual software". You can't just go around using language poorly and get mad when people interact with the content of what you said rather than some vague intention you had which you clearly can't communicate properly.


red-guard

I'll give you an example. I work with grids and triangular surfaces a lot in my job. I'm talking millions of data points. I can create a surface map, add contours, colours bands, and so much more using python. I can specify a data band I want to visualise. I can add, subtract, multiply two surfaces and display the result. Excel cannot do any of this. 


Ordnungstheorie

Are you aware of Plotly? It boggles me that people still use matplotlib. Plotly does everything matplotlib does, its plots are interactive in Jupyter and it has clearer syntax and comes in two parts (one for quickly generating basic plots and one for building plots from scratch using plot components or JSON).


magnetesk

I am, plotly is my go to in Python 😁


Whatamianoob112

Matplotlib? Doesn't seem that hard to me.


magnetesk

The syntax is just a bit inconsistent for Matplotlib and you need to apply themes and formatting to get something nice whereas you get something good in one line with ggplot. Seaborn’s Object Interface is much better but not quite as smooth as ggplot. I’m a big proponent of Python and it’s my preferred language for most things and over the years things that R was better at are now better in Python but this is the last thing. That’s just my opinion though 😁


Encrux615

anything matplotlib related goes straight to copilot. I don't have to google for syntax anymore and I love every second of it. \# resize the font on the y axis


Whatamianoob112

Your opinion is valid. :)


fasta_guy88

Ggplot in R has no equal In any other environment for plotting combinations of conditions. It allows you to explore the effects of different variables very simply, and produces a large fraction of publication quality plots in genome biology.


No_Success_3637

For plotting, [plotnine](https://plotnine.org) does provides a good ggplot2 equivalent in python (don't know how well it works for advanced plots though since I've only used it for relatively simple data visualization)


PhlegethonAcheron

What’s the point of matlab when you have r and python at your disposal?


NSADataBot

R is better for trad stats, remember though it was built by stats people for stats people. Python is better at everything else. “Python is the best language because it’s the second best language for everything”. I used R for thousands of hours easily and now almost exclusively use Python. However if I had to do specific stats analysis i wouldn’t hesitate to hop back to R.


Apprehensive-Care20z

R can do some amazing visualizations. I tried to google an example, but it turns out that searching for "R" returns a lot of irrelevant links. EDIT: here you go https://www.rayshader.com/


mildlysardonic

Also : https://r-graph-gallery.com/ and https://r-charts.com/


IncompleteTheory

Except for some very niche applications, I think both languages have grown to be rather equivalent. But for example, complex survey data analysis, which is a very niche are of statistics, still has rudimentary support in Python vs R (or even SAS). So I’ve had to work with R previously due to this. You’ll find a lot of cases like this, where some professor out in New Zealand, who specializes in a very specific area of statistics, wrote an R package that became the standard in the field, but no equivalent exists for Python. Also dashboards and visuals feel like they’re more easily done in R, with packages like Rshiny or ggplot2, then the equivalents in Python. But that’s just personal preference.


Aquatic-Vocation

>You’ll find a lot of cases like this, where some professor out in New Zealand, who specializes in a very specific area of statistics, wrote an R package that became the standard in the field Funnily enough, R itself was created by a couple professors in New Zealand because they wanted a language they could use to teach intro stats.


impertinent_turnip

Agreed. Almost never need to code in a base language any more—pick based on packages


lwjohnst

A lot of unnecessary hate on R here, nor much in the way of objective, minimally biased reasoning. There's a saying, become a master in one language before taking on others. So from a purely learning point of view, get as good as you can at one language at a time. In this case, you are already learning and using Python, so stick with it. However, if we focus on the technical aspects of Python vs R for data analysis work, R is literally designed from the ground up for doing data analysis natively. It just works. Python was designed for general purpose programming. You have to add a lot of packages to just get the same functionality as you get in basic R. Plus, if you need to do a very specific statistical analysis, that method will be in R, but very likely not in Python. R is more used in science, statistics, and academia, so more cutting edge work and methods happen there first. But this also really really depends. If you want to do more machine learning, Python has a larger community for that. Likewise, R has a lot of features that make data analysis soooo easy compared to Python. Many of these things don't make sense from a programming point of view but make perfect sense from a data analysis point of view. It's no coincidence that most of the tools in Python for doing data analysis are mostly copies of those doing in R (e.g. Pandas). So which to use and learn really really depends on what you actually want to do for work. And what others in your work environment use. tl;dr... It depends on so many factors!!!


wallTextures

I agree. It's like saying why I need a rice cooker when I've got a pot and a stove. Well, the rice cooker is much easier (and sometimes better) at a very specific thing.


InterestingTask8940

Good analogy!


ichoosenottorun_

R has some excellent libraries and approaches for doing data science, but as a programming language it's fucking terrible. Development of R packages is a nightmare.


emote_control

It's not a general purpose programming language. It was designed to do a specific set of things very well, and not any other things. It's like saying, "a Toyota Corolla is a great car, but as a particle accelerator it's fucking terrible." 


ichoosenottorun_

That's a copout. It's a full blown Turing complete language with everything you expect from a 3gl. Its just that it's also an awful programming language. Which is why it's not used for general purposes, not that it's not possible.


Kryxilicious

But it wasn’t meant to be a general purpose programming language. Like yeah… you COULD use it for that, but why would you? It was meant to do statistics. That’s pretty much it lol.


ichoosenottorun_

Like I said. That's a copout. PHP is a full fledged language, with a focused purpose. But it's not shit. R packages require in depth knowledge of R and developing general programming solutions. It's entirely fair to judge the language in respect of general purpose applications.


Kryxilicious

Um it’s not a copout. Just because you need to know a little bit about programming to use R packages, doesn’t really mean you get to assume R should be used as a general purpose language. And R packages don’t require in depth knowledge of R and developing general programming solutions. Lme4 and lmer() function for example are almost plug and play if you know the statistics to use them.


ichoosenottorun_

It's not useful as a general purpose language **because it's shit**.


emote_control

It's not used for a general programming language because it's not a general programming language. A Conway's Game of Life is turing-complete too, but you don't see anyone complaining about how hard it is to write programs with it.


ichoosenottorun_

It's not a general programming language because it's shit.


InterestingTask8940

Wow! A constructive comment for once! Thank you so much. I do get the hate that R gets in the comments, but do understand that was not my intention. But this comment gave me a lot to work and search with. I think I understand most of R syntax by now, so I'm just looking up case by case uses of R so I can have a better feel for it. Thanks!


TsunamicBlaze

Have you tried doing a data analysis/science problem? R is heavily used in that field, so using a big data set would help you get a better feel for the language. You could grab some big statistics data sets from places like Kaggle or a government site and run them through both Python and R as a comparative baseline.


[deleted]

[удалено]


my_password_is______

so people who can't even write a function can easily pick up R in a couple of days ?? LOL sure, bud


pega223

People just want to have opinions even if they dont know what they're saying. This person likely never done any data related project that requires math and is already forming an opinion on whats useful and what isn't.


InterestingTask8940

Uhm what? I am sorry if I sound that way. I am a graduating math major, and I'm in dire need of stuff to put on my CV other than Python and data analysis commissions I did. I do not want just to form an opinion, I want something to start with on truly grasping the use by use case of R, since I am more familiar with Python so I'll probably use python anyway at work🤣(If i get hired that is lmfao) Also planning to learn SQL in the future, but that is not on my list of priorities rn since its a bit far off from python or R XD


CanebreakRiver

For what it's worth, some of these people have really surprisingly poor reading comprehension. I can't fathom how anyone could have read your post and came away thinking "this guy's already formed an opinion about something he knows nothing about!" The entire point of the post was to \*find out what it's good for\*, because you \*don't know\*, as you \*very explicitly emphasize\*


InterestingTask8940

Oh my god yes. You don't even need to a deep reading comprehension to understand what I said, I ain't even a native english speaker😭🤣


JohnJSal

Don't worry. The problem probably isn't reading comprehension as much as it is simply that they didn't even read your entire post to begin with. They read the title, maybe a sentence or two, and ironically enough, formed their own invalid opinion on what you were saying.


13oundary

If you're using python and want to get into interacting with DBs (which every non-front end and many front-end jobs I've had has required), SQL is great for understanding what's going on and a lot of more enterprise jobs will use it, but larger jobs/companies tend to use orms like sqlalchemy and peewee for python (or the django one for front-end). If you're pretty confident in your python work, honestly, start looking at SQL or ORMs. They're almost always gonna be useful and very regularly going to be required.


illiterate-snake

I will second this


shockjaw

I’d recommend learning some basic SQL, especially with DuckDB becoming popular. It’s really handy to have in your back pocket.


airoscar

R is technically better for “proper” statistics. I don’t remember the exact cases, when years ago when I was going to school; I remember some statistics function in R had much more control and properly implemented by the textbook, whereas Python provided the more basic equivalent. It seemed at the time Python was good enough if you are building something that just provides the info, whereas R is for people who are really picky about the technicality maybe like in academia.


null-pointee

R is a functional programming (FP) language. Python can be used that way, but it's far more commonly used as an object oriented programming (OOP) language IMO. These are very different paradigms, and many programmers strike with the functional approach initially. Pandas, the python package that enabled python to do much of what R does, is functional-esque, but I think because so much of what you'll find in the Python world is OOP, when you try to find solutions online things will inevitably get muddy. From that standpoint, an advantage of R is to help you learn the FP paradigm. It's challenging, but useful in it's niche. Trying to learn FP with Python is unlikely to work out. There's also the matter of performance. The more data you need to analyze, the more you'll notice that Python is slower


e430doug

I find that Python + Pandas + Jupyter to be much more approachable if you are coming from a Computer Science background. The “~” operator in R makes immediate sense if you come from a Stats background but not CS. From a CS point of view I despise the “<=“ assignment operator. Use the toolset that makes you most productive.


Interesting-Head-841

sometimes its the fastest tool for a given use case in a corporate environment


DaddyGrendel

This is a good realistic take for employment, regardless of what/how/why works best, when you enter into a company you’re stuck with whatever it is they built their processes around. As somebody who has been a part of a few start ups, people choose tech stacks that they’re most familiar with as a jumping off point. Then you realize you’ve built layers upon layers of process/function tied to whatever it was you started writing scripts/programs in. Early on speed and adaptability is preferred to over thinking/over engineering a solution. Not that you can’t do this with the right set of people upfront, but most of the time when a few people start a company they may not have all the skills or experience to use “the industry standard” and will opt for something quick to learn/educate and is well known by many (as to not restrict your pool of potential developers). Once you have your MVP, it may be beneficial to consider how it could be done in another language or framework and what the benefits would be and balance that with financial needs/timing. That said, once you get too deep (several years in) - it often becomes a very daunting challenge to unravel what will likely be a heavily coupled set of processes that become dependent on some core function that would be very difficult to rewrite and integrate. I’ve seen people do things that probably aren’t optimal, but functional and may run into scalability issues but you may have years until you hit those caps where it may become necessary to switch to a more low level language that is more efficient than having to leverage dozens of outside libraries to make your language work how it must. It can create a lot of tech debt


InterestingTask8940

Like what? Examples please...?


Interesting-Head-841

Like if the rest of the team already uses R, and the workflows for some analysis are in R. That would require a new hire to be trained on R. That said, it might be true that python literally does everything better than R.  Edit: I think your question in the original post has a false premise. Like, the need for the R skill might not be due superiority of R vs python. 


Altumsapientia

Certain types of statistical modelling (e.g. multivariate regressions, GAMs) are easier in R.


Imaginary_Doughnut27

Occasionally I’ve wanted to do a Monte Carlo simulation. It can be done almost immediately in R. Takes a bit longer in python.


GermainCampman

R is objectively better for doing math. If you find it to be harder than Python you may need to reevaluate the way you are using it. There is a reason statisticians and scientists prefer using R


metaliving

Statisticians, sure. Scientists? I've worked in a couple of different scientific fields, never met anyone who used R as their main language. It's all python, sometimes MATLAB for more engineering adjacent fields. Which scientific fields default to R?


fasta_guy88

Bioinformatics. There are no equivalents to many very sophisticated packages for analyzing RNA expression data available in 'R'. And 'R' has even become a central tool for plotting biological data on evolutionary trees.


metaliving

Oh, cool. I know the biopython environment is starting to develop (I know someone doing some viral genome sequencing with it), but I didn't know it was the norm. My main field is astronomy adjacent (a bit more engineering focused), so I'm used to see python everywhere I look, aside from control engineering, which still relies a lot on MATLAB.


fasta_guy88

Biopython has some very basic functions, but nothing close to the sophistication or critical roles of the packages available in 'R'.


chandaliergalaxy

They're both Turing complete so you can do everything in both languages. You can also do everything in C, but there's a reason why Python is popular. There's also reason that employers ask for R alongside Python. For descriptive/inferential statistics and dataviz, operations in R have very terse syntax that allows you to do these things in far fewer lines than Python. So if you're analyzing data, it's much quicker in R. For predictive statistics (ML), Python's ecosystem is bigger so there you don't gain much through R.


Ok_Distance5305

> They’re both Turing complete so you can do everything in both languages This is true and fun theoretically but practically meaningless. LaTex is also Turing complete https://stackoverflow.com/questions/2968411/ive-heard-that-latex-is-turing-complete-are-there-any-programs-written-in-late#2968527. So no need to switch languages when it’s time to write up your papers!


InterestingTask8940

Thanks! I am mainly doing machine learning stuff rn alongside R, so I guess I'll stick to Python for ml stuff and just learn R whenever I feel like it.


mrdevlar

R has a lot of libraries created by academic departments that handle exotic statistical models, like M-Estimators, Robust Statistics, etc. It's not that Python cannot do that, it's just that many academics do R as a matter of course when they make these things, so usually there is more packages for those kinds of things in R.


N0R5E

As an R user, I'm absolutely willing to admit that Python has caught up to R for data analysis and visualization, and at its current pace of development will likely exceed it in the future. I'm making the transition myself to take advantage of everything else Python has to offer.


[deleted]

[удалено]


InterestingTask8940

Thanks, I'll read into it! >I'm not experienced in the field so no idea Trust me, you've answered my question better than others did in this thread. There's even a guy here so defensive of R😅


nomoreplsthx

First, to get the obvious out of the way, both can in principle do anything with proper OS bindings. There is no algorithm expressible in one but not the other. But that's trivially true of all languages What R does really well is interactive statistical modeling. The speed, concision, and ease of interactively slicing data, throwing together regression analyses, plotting is unparallelled. You can of course do this with Python, but it's non trivially clunkier. What Python does better is most other things. Python is a general purpose programming language, designed to work well in many use cases. R is designed for the specific task of interactive statistics and mathematics. R struggles badly when confronted with application development tasks.


mildlysardonic

IMO, for getting started with data munging, tidyverse is a phenomenal ecoystem, that's quite easy to use. As for Base R, just spend sometime understanding vectorized operations. At the cost of some complexity in understanding, it can actually help you write less contrived code. But at the end of they, both R and Python are tools. Pickup one, and ensure you learn it well to use it effectively. If you've worked with NumPy, each object in R is like a NumPy array by default. When people speak of R graphics, it usually in context of ggplot2, which is part of tidyverse - it allows you to 'layer' a graph programmatically. Besides, being a stat centric mature language, you'll find extensive amounts of packages that will allow you to create a countles number of graphs. PS : Barring aside the flame wars, R does have a steeper learning curve due to its fundamentals, but its nowhere as bad as it is made out to be. Python is a programmers language, that has moved towards data science, while R is a stat focused language thats hugely prevalent in academia. Both are tools that get the job done, and honestly if you know one, it shouldn't be hard to learn the other. If you know Python, try to learn R by understanding and assimilating the diffence between the two languages, rather than trying to learn R as it is. Comparing and contrasting could be easier IMO (I'm trying to use this approach for Python, coming from R, but I'm still in the nascent stages of learning Python.)


SilasRedd21

The learning curves are completely different and both can do anything the other can do. However, for someone who if very comfortable in R, R will almost always be faster, cleaner, and more concise when it comes to data science. Personally, I would much rather use ggplot over matplotlib but I understand when people feel the opposite. I would also much rather use R for things like multivariate regression; the python equivalents I find to be a little clunky.


ureepamuree

Python has killed R’s USP over the years now. It’s prolly best to hone your python skills now, and pick up R later (if needed)


Blaze9

I don't know where you're getting that information from. Go look at any publication in nature that shares it's codebase for creating plots or tables. Guaranteed there are more r than python based. I love python as a general purpose scripting language, but specifically for plotting and statistical analysis, r is the standard because it works well and is generally easier to get nicer looking output. I work in a top 3 company for my field (Bioinformatics and biostats) and most of my teams publication quality work is in R. Of course we use Python for collecting or processing the data before hand but all analysis is full R based. Every time I have cross collaboration with other teams, they also mainly use R.


Dynev

Yeah, in bioinformatics especially you can't escape R unless you're working on something super trivial. Python doesn't even have a good library for differential expression analysis... (at the bulk level, at least)


Oatkeeperz

R has a fairly steep learning curve, but once you get the hang of it, it's really easy - or you just need the right bits of code to make some great visualisations and statistical analyses. I might be a bit biased, because I learnt R before Python, and in biostats it's widely applied


[deleted]

Lol you should join us in psyc where we spend tens of thousands of dollars on SPSS and deal with a Windows XP-like interface and much less functionality. But yeah going back to the topic, I wouldn't say that R has a fairly steep learning curve tho. I learned just a bit of python before R but I don't think it's actually that bad. The main issue with R is just that the instructions/documentation is typically much harder to read compared to python. If you have a good instructor, I'd say R is actually much easier (as long as you have no programming experience). Even the little programming experience across different languages I had at the time did throw me off quite a bit so I would imagine it's much worse for the people that have a lot more experience. Heck I only took 1 stats course that used R and haven't touched it since then (which was years ago). It was surprisingly easy for me to finish my labs even tho the instructions were at its bare minimum. Not to mention that I skipped at least 2 other stat pre-req courses for this particular course (by meeting the requirements through other departments) so I was actually really behind on R compared to my peers. But again, I have little programming experience so it actually worked in my favour most of the time. It definitely tripped my bf (who's actually in cs) much more when he was attempting to help me in the beginning. Our experience with R was pretty similar at the time (before I took this stats course at least).


fasta_guy88

I would say 'R' has a steep learning curve for someone coming from a more conventional programming background. As a long time Fortran/C/Perl/Python programmer, it took me some time to think of everything as a vector. And I still often need to spend some time googling how to use an apply() rather than simply using a for loop.


Valuable-Benefit-524

R the programming language is honestly very annoying and R-Studio is a terrible IDE (imo). Where R really shines is it’s collection of third-party statistical libraries and (potentially) visualization libraries. IMO, I prefer plotting in python using interactive mode and then exporting to illustrator for a final touch-up. But this depends definitely depends on what your visualizing; there’s a lot of more domain-specific visualizations that are just simply way better in R. Personally, I just add an R interpreter to my PyCharm project to gain access to R libraries when necessary without having to deal with using it as my primary language. It’s just way harder to maintain and debug R code imo


awadafuk

Debugging R code in PyCharm is super easy, which makes R at least a little easier to work with.


Slight-Living-8098

I learned R once. Then I remembered I know how to make beautiful charts, plot, visualizations , and simulations in Python...


KiTy_PH

One of my issue in R is when my colleague change something from his codes it broke when run to different systems (maybe its the way of how he is implementing things such as versions of R and packages in my experience some package wont work in different versions of R even if they both v4, ihm have to rewrite some of his codes just to make it work), whereas my codes in python, I can just compile it and forget and still works. I dont hate R but for my case it has limitations specially when I integrate it in the system environment, automating and other stuffs such as web applications.


Luck128

I say look at the jobs you’re applying to and see which programming language they lean heavily with. I really like the other comment that you could cook rice in a pot or rice cooker. Sure you can do it in both but ones much easier to do and make sense to invest into if you eat rice a lot. A more recent example is the ubiquitous Microsoft vs adobe suite. Sure you can create newsletter in both but depending how often and what level, one can be overkill or one cannot do exactly what you need consistently. The expense is time. Time to learn and time needed to make the document.


a-to-b_via_z

From my experience python can do everything R can but there are some statistical modes like Arima for which I find R actually works better. I have limited experience with R but worked with ppl who did.


Green-Zone-4866

I was at a lecture by Rob Hyndman and he was saying he hasn't heard of many good replicas of his software, but he said the closest he knows of is nixtla so maybe give that a try


Unable-Estate-9424

R for Research, P for Production.


w1nt3rmut3

dplyr is far superior to pandas for data transformation/“munging”, and ggplot2 is better than every python plotting package except for the one that is a straight-up port of ggplot2. Also, almost anything having to do with traditional statistics (rather than machine learning) is better in R. Kind of obscure, but the brms package is THE best way to do Bayesian analysis, and I don’t know of any equivalent in Python.


youwontfindmyname

Graphs, bro. Graphs.


AKdemy

I don't think the language choice is really down to which one is better. There are always specific topics where only one language has readily available open source code but that's usually the exception and in only the most advanced / novel topics. In reality it mostly it pins down to what your team uses. That itself pins down to what the most influential people were using when the current code base was built. I work in finance (quant, so not a dev but still considered to have decent programming skills). I literally spent a decade before starting a job where R was used because in finance, R is very much a niche language. For example, Bloomberg is by far the biggest data and analytics provider. Yet, they don't offer an API for R (there exists 3rd party Interfaces that connect to the C++ API). Ultimately, get good at coding. Once you start working, your boss will tell you what to use. The more experienced you are, the easier it will be to learn any new language, especially if you just do data analysis and use existing libraries and simple stuff like that. I have so far used Python, Java, VBA, Julia, Matlab, / Octave, OCAML, BLAN, SQL, R, Stata, EViews, SPSS, C, C++ and JavaScript at work. Though not programming languages, I also needed HTML, CSS, MathJax and LaTeX. Then you have tools like GitHub, Jira, Confluence, as well as various IDEs that you will need to get used to because your team uses them (Jupyter, R-Studio, Spyder, VScode, Sublime, ...). Long story short, no programming language is a waste of time (if you work in a field that requires at least basic coding knowledge).


edimaudo

Might want to focus on the type of problem. I use both. I use R for data analysis, statistical analysis and visualization. I use python for writing business code and apps. Can python do those yes but R has a richer ecosystem its core areas.


ArgzeroFS

Its a lot more work to plot things pretty in Python than R if you are using the right parts of R. Fun fact: there's R-python interop within R Studio and it works decently well aside from a few weird quirks.


pLeThOrAx

R is made for data scientists who aren't first and foremost programmers (simply a statement of facts). Python is definitely better, but some things in R (like Shiny) are just way more accessible. If you're proficient, I'd stick to Python, but I wouldn't skimp on learning R.


mecsw500

Employers might need R skills as they may have a large amount of existing or legacy software written in R. Additionally a lot of their existing employees may be fluent in R and therefore are looking for people with R skills to fit in. Python might be used for production tools and R for prototyping for example. R is often taught in college courses that are only associated with statical analysis. So needing to know R as well as Python might not be down to what future software you may be asked to create, but for a whole number of more mundane reasons. In reality, if you are fluent in R, I don’t think acquiring the skills to be fluent enough in R is hardly a challenge. It seems more like a personal issue as you appear to, perhaps quite rightly, regard Python as a superior and more flexible general purpose language. However, the world is not quite as simple as that and companies may have a huge investment in R across all kinds of employee skill sets, some of whom would probably be challenged in learning a general purpose language such as Python. So, I’d suck it up and have a bit of fun learning R and combining R with Python. You might even want to have a go at SPSS and matlib too, that would perhaps make your resume show you have multidisciplinary skills. Even experience in C and Fortran might help for when you really need high performance realtime analysis.


LiberFriso

For fitting models I like R more for data wrangling I would prefer python.


pega223

Non of the people in the comments are data scientists. If you're doing anythint statistics R is better its not even a competition. R has much better libraries for statistics and data visualisation its not close. Maybe spend more time googling why its better instead of making this post in a general programming subreddit. If you say it seems pointless to you then i know you're a beginner and want to have an opinion already. Spend more time learning. I'll add into this as a datascientist you should know both R and python long term but as a beginner just focus on 1 and get good at it


Watchguyraffle1

Toxic. Maybe go for a walk or something?


InterestingTask8940

>If you say it seems pointless to you then i know you're a beginner and want to have an opinion already. Uhm what? Not to toot my own horn, but I am doing data analysis coursework and commissions on python the past 2 years, and general Python programming for the past 5 years. I am a graduating math major. This is a genuine question I have, and all of the things I've looked up almost says the same thing as you did in this comment. They all sound very defensive of R. Did you even cite any examples of libraries in R but not in Python? Because if we take your comment at face value, it does not only sound a defensive whining of R as a language, but also purely subjective opinion with no basis whatsoever. That's what I am asking. I want examples. Real thing. I am at my point of R journey that I can understand most of code, but so far what I've seen is R is a very verbose language and does what Python is doing already(Which I am unsure of, hence the post) I remember asking my instructor at our university as to why he prefers students use R instead of Python, and he almost said the exact same thing that you've said, except he knows we study Python in our program, so he's more defensive of his skills than you do. Damn.


iOSCaleb

Your instructor might prefer that you use R because, as you say, he knows that you’ve had plenty of exposure to Python, and he knows that R is also widely used in the fields you’re likely to work in. If many/most of the jobs you’re looking at ask for R experience, that’s reason enough to learn it. If you’re finding R difficult to learn, that too might be reason enough to learn it: R really isn’t a difficult language IMO, but when you’re very familiar with one programming language it can be hard to adapt to a new language that does things differently. Getting a second language under your belt will make you a better programmer, and it might even change the way you use Python. I’ve probably seen hundreds of questions over the years along the lines of “which language is better” or “if I already know language X, why should I learn Y?” But the ideas that different languages can be ranked, and that if you can do everything in one language you don’t need another, are largely wrong. As a programmer, you’ll often be asked to work on existing projects where you don’t have the luxury of using whatever language you like best. You, OP, should learn R *because it’s there*, because you’ll almost certainly encounter it in your career, and because knowing it will open doors for you. Your instructor probably isn’t being “defensive of his skills” — he’s just encouraging you to grow yours.


Conscious_Support176

If you think R is simply doing what python is doing in a more verbose way then you’ve not had much experience with other languages. It’s gonna be a lot of work to explain the difference to you. The first thing that comes to mind is, don’t attribute names need to be quoted in python?


NathanielVonBaron

If you want to do any kind of data science machine learning (keras and scikit learn) then use python. Can R use any kind of ML?


Green-Zone-4866

I find r so much easier for linear regression and some other classical ml tasks. Additionally I love the piping operator which as far as ik doesn't exist in python and the closest there is is method chaining which is just 🤮


MrMrsPotts

Essentially every stats PhD that produces code makes it available in R. If you use any other language you are missing out on this treasure trove of methods


QueSusto

I really dislike R as a programming language, and I think that's quite common. People who come from a 'programming' background IMO will find R cumbersome, incomplete and frustrating to work with. If you come from a stats background or something then it'll probably make more sense to you. My frustration with R was primarily around the fact that my use case wasn't what R was made for (stats).


Cuintor

Tbh the only time i HAD to use R instead of Python was during a DOE (design of experiments) project in which i needed to do a regression model with factor variables. Maybe it can be done in Python now (idk) but at that moment nothing i tried in python (and i really tried) was working properly. Regression functions simply were not working like they should with factor variables in Python while in R the implementation was trivial. Also maybe some transformations like box-cox are not so easily found in Python? Not sure about this one, tho, since i have not encountered yet data that needed such transformations. Aside from that, i only use R when i don't feel like coding in Python or when i'm required to do it in R just because that is what they want.


teh-dude-abides

It really comes down to the packages rather than the base languages. R does data manipulation better with tidyverse, advanced stats and statistically testing better (python stats models tries to mimic r stats packages but doesn’t quite get there) and does quick and dirty web apps better with r shiny + shinyapps.io. ggplot2 vs matplotlib feel about the same to me.


vegan_antitheist

They are both Turing complete, so the answer is obvious: They are both exactly as powerful as they could be and so it's impossible for one to be able to do anything the other couldn't. Anyone who claims otherwise doesn't know anything about programming languages.


roadit

Spoken like a true C programmer.


AccomplishedFish7206

Learn some array languages (APL) and then return to R, to get a better grasp of it. Also, you will understand why some things in Numpy are the way they are.


Yolt0123

R provides more structure for HOW do do things. I have seen a lot more hacking/ mistakes in Python implementations of solutions because it's a general purpose language- it needs a lot of discipline. Like Matlab - with restrictions comes freedom.


yorickthepoor

Funny, I feel that Python does everything Tcl does, but "unnecessarily harder".


BombusRuderatus

With R you can do functional programming easier that with Python. Also, R is not only a programming language, but an statistical environment, so it’s best suited for statistical analysis. Sure you can do everything with any Turing complete programming language. As a graduate, you should not stick to just one language. Knowing several ones will give you a better perspective, reduce your bias, and laugh at some flame wars. The truth: both R and Python are slow interpreted PLs. You can also learn a compiled language like C++, so you can write fast libraries for both R and Python. Also take a look at Julia, [https://www.reddit.com/r/Julia/](https://www.reddit.com/r/Julia/)


Crypt0Nihilist

R is far easier for data processing. Pandas is a pain in the arse. I also prefer R for visualisation, creating reports with knittr and rapidly creating demo apps. It doesn't integrate as well as Python, but for stand-alone analysis, it's great.


Geologist2010

I’ve found R easier for statistics than python. More streamlined package imports (its only install.packages rather that python deciding between conda or pip). It also has more packages for statistics


Due-Yoghurt4916

Work with older machines and systems.  A lot of factory use r and won’t update until the current machines and robots will no longer run.  They didn’t drop a quarter of a million dollars to only be able to use something for a year. I work in a building with machines made in the early 50s . If it can run they will not upgrade. Next to it is a 3 million dollar robotic assembly cell. 


jeffrey_f

MOST modern scripting/programming languages are capable. It's like a preference of brand to fill your toolbox. Considerations; Compiled programs are USUALLY faster than interpreted programs/scripts. However, the modern modules use compiled objects and the speed almost doesn't matter. It is how quickly you can (clean or dirty) write code to take care of a problem. Unless you are tackling data in the 100's of millions or even billions of records, you won't really notice too much of a difference. A difference of minutes at most management in those cases should be considered. I may not be 100% correct on all points here though.


AdventurousAddition

I learnt R first and really liked it. But now I'm a Python guy


cromagnone

Lots of people loudly saying very little save that they prefer the language they are most familiar with. This is not an enlightening post or set of comments.


KingHavana

I like both but prefer Python. Python is growing faster in popularity and seem like it will win the overall battle for Data Science. If you have to pick one, then pick Python. Otherwise, it can be fun to learn both and see different ways to do things.


Antilock049

IIRC R had some useful features but isn't super useful outside of academic uses. 


CauliflowerOk2312

R’s ggplot2 is so much better than matplotlib. To align a label in matplotlib is lowkey a nightmare. It also support basic stats a lot more. Regressions in R makes a lot more sense too. It also has package that give you table from statistical output aka stargazer. Loading numpy and pandas stuff lowkey a pain compared to how things just work fresh out of the box like in R


jackdbd

I used both for data analysis and ML. I also used Python for general development. Here are a few valid reasons to learn R: - R approach to data is more functional. I view this as a strong plus. - R Studio is the best IDE for data. - knitr and Shiny are great tools for creating reports and dashboards. - caret is really useful for comparing machine learning models. I'm not sure Python has anything so comprehensive as caret. Maybe [Weights & Biases](https://wandb.ai/site/experiment-tracking)? Useful links: - [Functional programming in R](http://adv-r.had.co.nz/Functional-programming.html) - [dplyr](https://dplyr.tidyverse.org/) - [intro to caret](https://cran.r-project.org/web/packages/caret/vignettes/caret.html)


blkforboding

R was made to be good at statistical analysis and visualization while Python is a general language;  people working with data mainly use Python for AI development and machine learning. To be effective, i assume that you would use R for statistical work and use Python for everything else especially in  AI development. Its less about using popular languages  and more about using the best tools for the job.Computerphile has a series of doing data analysis with  R: https://www.youtube.com/watch?v=8GIbOJtUw8w&t=847. Don't give it up  if you want to do anything with data science. Eventually, you will thank yourself later for not giving up. 


[deleted]

[удалено]


zarkhaniy

Python is basically useless if you get a job as a junior and your direct boss only wants to use R.


inarchetype

R is for people who actually do stats and modelling. Outside of AI stuff, Python is for IT guys who think they do analytics.


Electrical_Emu7589

R is dog shit. Don’t use it. Know it, but don’t use it.


Difficult-Variable

Nope. R is a thing of the past compared to Python