top of page

How to switch between data Structures

If you read this, perhaps it’s because you followed some tutorial about R, either here or elsewhere and probably, not being a professional programmer, you found the official documentation somewhat obscure at times. After reading this you should be familiar with the different data structures that R offers: vectors, list, matrices (or arrays with higher dimension) and you may want to investigate about Tables as well or understand how R works together with SQL type databases. But how should we use those structures, e.g. when is it that a certain structure is more or less appropriate than another and, having information ‘stored’ in one of these, how would you switch to another and why? Data handling is central for any type of analysis you wish to carry out, whether as a future Data Scientist or ‘just’ to win the latest exciting Kaggle competition. We’ll cover the basic data structure before looking at some typical cases of handling of data. We then delve then into the most important of them all, at least in data science, aka the data frame using a slightly more comprehensive example (as comprehensive as a simple tutorial will allow). Enjoy!

Figure 1 - Data structures in R

Who am I?
Carlo Fanara

Following a career in IT, I spent 20+ years in physics (MSc in Nuclear Physics, Turin, Italy, and a PhD in plasma physics, Cranfield, UK).

After several years in academia, in 2008 I moved to private companies working in R&D and, since 2014 in Data Science,

My passions include Science and Languages.

I teach programming and Data Science and occasionally blog on these matters..

Current interest: Deep Learning, IoT, Time Series, and Rare Events.

Teaching
Mind your business!
Places I visit
Follow Me
  • LinkedIn Social Icon
Search By Tags
bottom of page