r/C_Programming • u/Feeling_Valuable5239 • Jun 01 '26
Question Is the C programming language used for data analysis in scientific research?
19
Upvotes
r/C_Programming • u/Feeling_Valuable5239 • Jun 01 '26
12
u/Living_Fig_6386 Jun 01 '26
Yes, though primarily to create high-performance implementations of algorithms as libraries that are typically called by other languages.
For example, I frequently use a weighted linear sequence alignment algorithm. We wrote it in C for performance (many orders of magnitude faster than something like Python), and then wrote Python and R wrappers for it, where it integrates into our scripting and analysis processes.
It would be very cumbersome to do all our day-to-day in C.
46
u/bi-squink Jun 01 '26 edited Jun 01 '26
Technically yes and no.
Python is usually used for data analysis and research because of the simplicity of Numpy and Pandas libraries.
Under the hood the python modules used are written in C.
So technically it is used, but explicitly not so much since it's reinventing the wheel.
edit: for some reaserch like program efficiency and tool efficiency it's used heavily!
8
u/Schaex Jun 01 '26
We are doing NMR spectroscopy at our research group. Most of our data processing, especially Fourier transformation, peak detection and transformation of binary file formats, is done using programs one of the oldest group members wrote in C during his PhD.
That guy is an NMR God lol. He is still writing some utilities, but the bulk of the programs is there.
However, I actually don't think this is very common. I reckon nowadays only the bare high-performance functionalities are implemented in compiled languages like C or Fortran, but the actual processing/analysis is done using bindings from high-level languages like Python. This is basically the idea behind numpy.
3
u/catbrane Jun 01 '26
We do the lowest levels in C / C++ (image processing), the middle parts in python (connecting image processing operations together to implement useful algorithms) and the top-most sections in bash (omg argh).
As others have said, you'll have different needs at different points in the stack, and that often means a different implementation language.
3
u/DreamingElectrons Jun 01 '26
In the past it was one of the more commonly used language to write tools in. When I was a student R was super common for data analysis, by the time I finished my master, it has almost completely been replaced by python but the libraries that python calls to do the heavy lifting are C, C++ and even still some ancient Fortran solvers. So in some way C is still used for data analysis in science, just not in a way that most people would interact with it. I later worked as a data steward in biotech and also didn't need any C for that. Still doesn't hurt to know some C.
7
u/cneverdies Jun 01 '26
python and R and also matlab are better in this
4
u/One-Payment434 Jun 01 '26
Is nobody here using Fortran anymore?
2
u/THREAD_PRIORITY_IDLE Jun 01 '26
Yes it is. Fast code is very helpful with hyperspectral data analysis.
2
u/Norse_By_North_West Jun 01 '26
Yeah, under the hood. Others have mentioned r and Python, but SAS is another big one. I've made libraries for it before, and it's all in C.
2
u/reini_urban Jun 02 '26
Of course. Most such libs are C libs.
3
u/NedStarkX Jun 01 '26
Usually Python and R are used, C is for high performance libraries and systems programming
2
u/Revolutionalredstone Jun 01 '26
As an elite c programmer and high paid data analyst i can dishonestly say no: keep using python ;)
1
u/MyTinyHappyPlace Jun 01 '26
Yes, but R is way more prevalent and useful in the long run.