ABSTRACT

This chapter provides an introduction to general R and Python programming in a parallel fashion. R and Python are general-purpose programming languages that can be used for writing softwares in a variety of domains. One can see two functions log and exp when they use R/Python as calculators. A function is a block of code which performs a specific task. A major purpose of wrapping a block of code into a function is to reuse the code. To implement a complex logic in R/Python, one may need control flows. Break/continue helps if people want to break the for/while loop earlier, or to skip a specific iteration. In R, the keyword for continue is called next, in contrast to continue in Python. In R, people can use function c() to create a vector; A vector is a sequence of elements with the same type. Array is one of the most important data structures in scientific programming.