In the implementation of programming, sometimes the need for numerical rounding is encountered, and the way of rounding is varied, depending on the specific problem, but R has been equipped with a full range of related functions.
It mainly includes the following five types: floor(): rounding down; ceiling(): rounding up; round(): rounding round; turnc(): rounding to 0; signif(): precision reserved for positioning number .
R is the open source version of S(Splus), or the next generation. The birthplace is in Auckland, New Zealand. The statistical background of this software is very strong. My strong meaning here is that if you are not familiar with statistical knowledge (history), R's help documentation looks very tired. Developed by people with statistical backgrounds. The maintenance group of R is called CRAN-R. Convenient in biological information, there is an organization called bioconductor, which has a lot of software packages that can be used in biological information. They have a self-maintaining package system.
Python is a comprehensive language (here specifically referred to as the CPython interpreter), numpy scipy is an extension of numerical calculations, pandas is mainly used for data processing (numpy dependencies), sympy is used for symbolic calculations (similar to mathemaTIca?) and there are some Too mature packages such as sciki learn, staTIsTIcal models. Maturity is not as good as R. But it has reached the level available. It is a statistical package written by a person who reads a computer. After ipython is updated to 1.0, the function is basically perfect, its notebook is very powerful (feels like mathemaTIca) and it is still web-based, which is very useful in cooperation sharing.
performance:
Everyone said that R is slow, especially CS people. In fact, there are two main points here: the call of an array in R is copied, and the second is slow. The third is to deal with big data slow. If R is used well, R is not too slow. Specifically, Rscript uses less, uses more commands, and runs small data. In this case, the actual running is the fortran and C library behind. They all have a history of twenty or thirty years. Can be described as exceptionally reliable, optimized can not be optimized again (refer to single-threaded, if you look at the source code volatilization first many inexplicable constants, always use high precision and fast!). For example, if you write an R script yourself and a loop loop, you really want to die. Plus, R processing text files is slow!
Python is ultimately a scripting language with an interpreter, and it's fatal - GIL, but the most valuable thing about Python is that it's easy to get faster. For example, pypy, cython, or direct ctypes hang C library. Pure python writes a prototype, and then it is constantly profiling and accelerating. It is easy to achieve an order of magnitude of speed with C, but the time to write programs and debug is much less.
Parallel Computing:
After R v15, there is a parallel package that comes with it, which is very easy to use. But in fact, it is a non-stop fork, or mpi, memory consumption is quite powerful. parSapply, parApply or something, is really good.
Although Python has GIL - a deadly enemy of parallel computing, but has multiprocessing (fork dependency), it is something that can share data. It is estimated that the memory consumption is better than R, and the data is scattered and there is a lot of overhead. When it comes to MPI, mpi4py is still very good. Combining openmp with cython can break GIL, but you can't call python objects in the process.
Learning curve: A classmate who assumes that programming is not possible.
R is still very easy to get started, check the basic commands, package, direct print will have results. However, if you want to write your own algorithms and optimize performance, the difficulty of learning increases dramatically.
Python, very boring, the vast majority of help documents are much better than R. Some packages are not convenient to use R. In general, the depth is steep.
Expand resources:
Basically, new statistical methods will have R packages, and installation and use are not troublesome. But basically it is a computer bag written by people who do statistics. So there may be hello in performance. More famous management websites with two packages, cran-r and bioconductor. Therefore, the estimation of biochemical R is very convenient to use.
Python's statistical calculation package is less than R, much younger, and still in development. It is better than a statistical package written by a computer person. When you use it, you should increase your mind.
Drawing:
The tools that come with R are very easy to use, and then there is ggplot, a very beautiful and powerful tool.
Python has matplotlib, the effect of drawing is better than R's own, and the interface is based on QT, cross-platform support. It may be that R is much more used, and pyplot is still not very easy to use, and it feels that the uniformity of its various components is not high.
IDE:
Rstudio is very good, providing a matlab environment. (Used vim-r-plugin, used emacs + ess now with vim.)
There are python(x,y) under windows and there are many commercial tools. (I am not very comfortable with the current emacs environment~)
Suggest:
If you are only dealing with (small) data, use R. The result is more reliable, the speed is acceptable, it is convenient to get started, and there are many ready-made commands and programs that can be used.
To do an algorithm yourself, handle big data, and calculate a lot, use python. The development efficiency is high and everything is under control.
Ps: Blindly using R's package is safer than using python packages for blind destinations. At least R will point you to a paper, and Python just points to a bunch of code. There are problems with R and the authors and reviewers are buried.
The difference between python and r languageThere are a lot of articles on the Internet about which data science should be used, which one is good, and who has more promising articles. But I still have to write my opinion:
Analyze and compare which of the two languages ​​is good, depending on your purpose. For example, I only need to analyze the data, that is, import data, analyze data, and visualize. It is reasonable to say that the R language is indeed dominant. If you want to apply the programming language in addition to learning, there is no doubt that Python is more dominant. There is a saying that "Life is too short, please use python".
In terms of data analysis and comparison, I think the advantages of R are:1. It is difficult to learn after the first easy, and will not scare the whites;
2, the data science package is particularly
3, visual special hanging
The disadvantages of R are also quite a few:
1, R is often updated, often does not support the package you installed before the update; I installed 10 + R version in my computer, keep switching
2, R language package, function name is very casual, look at the name does not know what to do, can not remember how to use the name white.
3, R language community is small, you can only solve the problem yourself
4, even with RStudio, writing code is not convenient
Let's talk about python below, the advantages:1. It is a language that understands and speaks human language. The library name and function name are very good to understand the memory, and you can see the code of others to know the meaning of this code. Do not believe you try.
2, data acquisition dominates, the first step of data analysis is data acquisition, and now many humanities and social sciences data needs to be crawled online, but in terms of data capture, python is more dominant. Various tutorials, code, a large online.
3, the community is particularly large, the basic problems you can find can be found
The disadvantages of python:
1. Learning is difficult at the beginning, and the learning curve is exactly the opposite of R.
2, to be fair, I still write, Python's data analysis library is not as good as R
3, visualization is not as good as R
The most important thing is that R collects data in this respect, especially on the Internet, and there are very few searches about R crawlers.
So I started to learn python in May, and I learned python3 from the beginning, insisting on choosing a promising version and sticking to it. Currently I can climb data in python.
Under the circumstance, it is recommended that you learn python, the language is easy to understand, powerful, and simpler.
ZGAR OPEN SYSTEM - ZENITH SERIES
Zgar International (M) SDN BHD , https://www.zgarette.com