chapter two

2 Getting started with Julia

 

This chapter covers

  • Understanding values and variables
  • Defining loops, conditional statements, and functions
  • Knowing variable scoping rules in Julia

If you are new to the Julia language, in this chapter you will learn the basic syntax of the language and most important concepts, where I put the focus on the aspects that are different in comparison to Python and R. Even if you already know Julia, I recommend that you quickly go through the presented topics to make sure you have a complete understanding of the basic concepts.

If you are not sure how to install and set up and use your working environment, how to get help, or how to install and manage packages, please refer to appendix A which contains information about these topics.

Note that this chapter, along with other chapters in part 1 of this book, are not meant to be a full course on Julia. They only contain essential information required for you to start doing data science in Julia. I recommend you refer to the books listed in https://julialang.org/learning/books/ or the Julia Manual https://docs.julialang.org/en/v1/ for a complete introduction to Julia programming.

In this chapter our goal is to write a function that calculates a winsorized mean https://en.wikipedia.org/wiki/Winsorized_mean of a vector. Let me start with explaining how you can compute such mean.

2.1 Representing values

2.2 Defining variables

2.3 Most important control flow constructs

2.3.1 Performing computations depending on Boolean condition

2.3.2 Loops

2.3.3 Compound expressions

2.3.4 A first approach to calculating the winsorized mean

2.4 Defining functions

2.5 Variable scoping rules

2.6 Summary