Sign in

The previous blog: “The data revolution” explains the main contributions of each industrial revolution. However, given industrial revolution represented profound changes and transformations in our society (which were not always positive). The center of life left the agricultural communities and moved to the factories, people left the countryside and came to the cities with the introduction of mechanical production. Electricity and mass production systems changed the way people lived and worked. And, more recently, the digital revolution caused disruptions in all industries through digital transformation — and the way people lived, worked, and communicated underwent major changes again.

Data is…


Los últimos avances en la inteligencia artificial robótica, blockchain, etc han tenido un gran impacto en nuestras vidas y han alterado la forma en la que vivimos y trabajos. Es por ello, que nos encontramos al borde de una revolución tecnológica.

Lo más probable es que recuerden las clases de historia acerca de la Revolución Industrial y el impacto de las máquinas de vapor. Sin embargo, el Dr. Klaus Schwab, fundador del Foro Económico Mundial (WEF, por sus siglas en inglés) y autor del libro The Fourth Industrial Revolution establece que una revolución industrial se caracteriza por el surgimiento de…


Vectorizing your functions

Vectorized functions are a very useful feature of R, but programmers who are used to other languages often have trouble with this concept at first. A vectorized function works not just on a single value, but on a whole vector of values at the same time. To try vectorized functions, you have to make a vector. You do this by using the c() function, which stands for combine. The actual values are separated by commas.

Here’s an example: Suppose that Granny plays basketball with her friend Geraldine, and you keep a score of Granny’s number of baskets in each game…


Photo by Ashkan Forouzani on Unsplash

Vectors

R is a vector‐based language. You can think of a vector as a row or column of numeric data, character data, or logical data. The list of numbers {1,2,3,4,5}, for example, could be a vector. Unlike most other programming languages, R allows you to apply functions to the whole vector in a single operation without the need for an explicit loop.

First, assign the values 1:5 to a vector called x:

x <-1:5x[1] 1 2 3 4 5

Next, add the value 2 to each element in the vector x:

x + 2[1] 3 4 5 6…


Photo by Mika Baumeister on Unsplash

Basic data types in R

R works with numerous data types. Some of the most basic types to get started are:

  • Decimal values like 4.5 are called numerics.
  • Natural numbers like 4 are called integers. Integers are also numerics.
  • Boolean values (TRUE or FALSE) are called logical.
  • Text (or string) values are called characters.

Constants in R

Constants, as the name suggests, are entities whose value cannot be altered. Basic types of constant are numeric constants and character constants.

Numeric Constants

All numbers fall under this category. They can be of type integer, double or complex.

# Change my_numeric to be 42
my_numeric <- 42
# Check class…

Photo by Lukas Blazek on Unsplash

Things to know before learning R

R is a programming language and environment commonly used for statistical computing, data analytics and graphics. It is one of the most popular languages used by statisticians, data analysts, researchers and marketers to retrieve, clean, analyze, visualize and present data. It is one of the most popular tool in predictive modeling world. Its popularity is getting better day by day. In 2016 data science salary survey conducted by O’Reilly, R was ranked second in a category of programming languages for data science

Companies Using R

Lilian Hale

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store