class: center, middle, inverse, title-slide .title[ # An Introduction to
[ comment ]
and RStudio for Educational Researchers ] .subtitle[ ##
Descriptive and Inferential Statistics:
Creating and Manipulating Datasets in
[ comment ]
] .author[ ### Jorge Sinval ] .date[ ### 2025-11-18 ] --- <style> .orange { color: #EB811B; } .kbd { display: inline-block; padding: .2em .5em; font-size: 0.75em; line-height: 1.75; color: #555; vertical-align: middle; background-color: #fcfcfc; border: solid 1px #ccc; border-bottom-color: #bbb; border-radius: 3px; box-shadow: inset 0 -1px 0 #bbb } </style>
# 1.2 Measurement Instruments In Social and Human Sciences, information is collected in different ways: **1.Direct observation** Participant observation, Focus Groups -- **2.Sociodemographic questionnaires** With closed, semi-closed and/or open questions -- **3. Psychometric instruments** Assess attitudinal states (Likert, Guttman, Thurstone, etc... scales) SIJS (job satisfaction), UWES (work engagement) --- # 1.2 Measurement Instruments **4. Psychometric tests** Assess aptitudes (knowledge, competence, skills, abilities and skills) WISC (intelligence quotient) -- **5. Psychophysiological assessments** Measurements of physical and biological parameters. -- Additionally, several other types of data can be collected, e.g.: financial, meteorological , spatial, etc... -- **After collecting data, it is necessary to create a dataset…** --- # 1.3 Measurement Scales ### **Qualitative** Variables organized into classes or categories. These classes can be represented by numbers which, however, **do not have a true numerical meaning**. -- ### **Quantitative** Variables that assume values represented by numbers with **true numerical meaning**. These can be: - Discrete: Assume a numberable set (infinite or finite) of values (e.g. number of children); and, - Continuous: They assume any value in a given real range (e.g. height). --- # 1.3 Measurement Scales According to Stevens (1946)<sup>📜</sup> variables can still be classified according to the scale used in their measurement. This classification is organized into 4 levels/scales: - **Nominal** (e.g. sex, country) Numbers (or other symbols) represent qualitative, mutually exclusive, **non-hierarchical** classes or categories. .footnote[ 📜 Stevens, S.S. (1946). On the theory of scales of measurement. _Science, 103_(2684), 677-680. https://doi.org/10.1126/science.103.2684,677] -- - **Ordinal** (e.g. academic level, socioeconomic level) Numbers distinguish qualitative, mutually exclusive, and **hierarchical classes**. --- # 1.3 Measurement Scales - **Interval** (e.g. temperature in degrees Celsius) Quantitative, discrete, or continuous values with fixed distances (ranges) between scale values, but .orange[without] absolute zero<sup>0️⃣</sup>. -- - **Ratio** (e.g. age, height, mass) Quantitative, discrete, or continuous values with fixed distances (ranges) between scale values, but .orange[with] absolute zero<sup>0️⃣</sup>. .footnote[ 0️⃣ Absolute zero: the origin of the scale always corresponds to the total absence of the characteristic under study, and it is represented by the value of zero.] --- # 1.4 Create dataset Sociodemographic questionnaire <center> <img src="assets/img/sociodemo.png" width = 50%> </center> --- # 1.4 Create dataset Psychometric instrument<sup>📜</sup> <center> <img src="assets/img/psychometric-instrument.png" width = 80%> </center> .footnote[ <sup>📜</sup> Sinval, J., & Marôco, J. (2020). Short Index of Job Satisfaction: Validity evidence from Portugal and Brazil. _PLoS ONE, 15_(4), 1–21. [https://doi.org/10.1371/journal.pone.0231474](https://doi.org/10.1371/journal.pone.0231474)] --- # 1.4 Create dataset ### Names for variables -- ### Naming conventions for a variable -- ### How to create variables in <svg viewBox="0 0 581 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;position:relative;display:inline-block;top:.1em;fill:#384CB7;"> [ comment ] <path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"></path></svg>? -- ### How to use the created variables? -- ### Components of a Variable --- # 1.4 Create dataset **Creation of the Coding Sheet** Document on paper or directly in <svg viewBox="0 0 581 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;position:relative;display:inline-block;top:.1em;fill:#384CB7;"> [ comment ] <path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"></path></svg>, with variable names, categories and numeric coding of categories (if required). --- # 1.4 Create dataset ### Names for variables **Some rules for variable names:** - Start with a letter. Do **not start** with numbers, dollar sign (`$`) or underscore (`_`). -- - After the first letter it can contain numbers, underscore or period. Do **not use** a hyphen (`-`). -- - Avoid using built-in function names (e.g. `c`<sup>⚠️</sup>). -- - Variables are case sensitive; `average` and `Average` are different variables. -- - Use names that are descriptive. Generally, nouns are used for variable names and verbs for function names. .footnote[<sup>⚠️</sup> `c` is used to name the function `c()` which is used to combine values into a vector or list. It is one of the most important functions. ] --- # 1.4 Create dataset **Naming conventions**: <center> <img src="assets/img/style.jpg" width = 65%> </center> --- # 1.4 Create dataset **Use a <sup>💡</sup>... convention and be consistent with it**: - All lowercase: e.g. `anyvariable` - Separated by dots: e.g. `any.variable` - snake_case<sup>🐍</sup>: e.g. `any_variable` - camelCase<sup>🐫</sup> lowercase: e.g. `anyVariable` - CamelCase<sup>🐫</sup> uppercase: e.g. `AnyVariable` -- The use of snake_case<sup>🐍</sup> gathers the preference of several prominent <svg viewBox="0 0 581 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;position:relative;display:inline-block;top:.1em;fill:#384CB7;"> [ comment ] <path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"></path></svg>s. -- .footnote[ 💡 Bååth, R. (2012). The state of naming conventions in R. _The R Journal, 4_(2), 74–75. https://doi.org/10.32614/RJ-2012-018 🐫 _CamelCase_ is the English name for the practice of writing compound words or sentences, where each word is capitalized and joined without spaces. 🐍 _snake_case_ is the English name for the practice of writing compound words or sentences, where words are separated with an underscore.] --- # 1.4 Create dataset ### Data types (five basic or "atomic" object types<sup>⚠️</sup>): -- #### `numeric`/`double` (real numbers) `\(\mathbb{R}\)` -- #### `integer`(integers) `\(\mathbb{Z}\)` -- #### `character` (string) -- #### `logical` (TRUE/FALSE) -- #### `complex`(complex numbers) `\(\mathbb{C}\)` -- .footnote[ ⚠️ There is also the `raw` object type, its use is rare in data analysis, as such it will not be covered.] --- # 1.4 Create dataset A variable has 3 components: - Name -- - assignment operator (.orange[**`<-`**]<sup>⚠️,🤓</sup> or `=`)<sup>💡</sup> -- .footnote[ ⚠️ It is also possible to assign a value to an object with `->`... 👀 but its use is rare 😬 💡 It is **good practice** to use `<-` for object assignment, and `=` for function parameters 🤓 the .kbd[Alt]+.kbd[-] key combination automatically inserts the `<-` operator ] -- - variable value --- # 1.4 Create dataset The value of the number of students in the classroom can be stored by creating a variable and assigning the value to it. In this case, a variable called `students` can be created, and the value `\(5\)` can be assigned via the assignment operator `<-`. -- ```r *students <- 5 students ``` ``` ## [1] 5 ``` -- .footnote[ ⚠️ Do not insert spaces between the two assignment operator symbols, if there are spaces: `< -` the _R_ will interpret the code very differently. 😐 ] --- # 1.4 Create dataset Once created, variables can be used in calculations. The relative frequency (in proportion) of attending students taking in consideration the `class` size can be calculated (`\(N = 10\)`). -- ```r #assign the value 5 to the students variable students <- 5 #assign the value 10 to the class variable class <- 10 #compute the relative frequency of students in the classroom fi_students <- students/class #call the fi_students object, and check the relative frequency of students in the classroom fi_students ``` ``` ## [1] 0.5 ``` It can be described verbally by saying that the variable receives a value of 0.5. --- # 1.4 Create dataset ### Components of a Variable 1 - Name -> `students` 2 - Address (memory) -> `0x6d8d8c8` 3 - Value -> `5` 4 - Data type -> `numeric` --- # 1.4 Create dataset ### Components of a Variable: Attributes Objects in <svg viewBox="0 0 581 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;position:relative;display:inline-block;top:.1em;fill:#384CB7;"> [ comment ] <path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"></path></svg> can have attributes (i.e. metadata) that help describe the object. -- Examples of attributes: - `names`, `dimnames` -- - `dimensions` (e.g. `matrix`, `array`) -- - `class` (e.g. `integer`, `numeric`) -- - `length` -- - other user defined attributes -- An object's attributes (if any) can be accessed with the `attributes()` function. Not all R objects contain attributes; in this case, the `attributes()` function produces `NULL`. --- # 1.4 Create dataset ### Data types: `numeric`/`double` In <svg viewBox="0 0 581 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;position:relative;display:inline-block;top:.1em;fill:#384CB7;"> [ comment ] <path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"></path></svg>, numbers are usually represented by the `numeric` data type (i.e. `double` -> double precision floating point number<sup>🤔</sup>). .footnote[ 🤔 stores a floating point number with space to indicate larger numbers, either integer or decimal part.] -- The `1` that the "naked eye" can consider as an integer, internally can be a `numeric` object (thus `1.00`). -- To explicitly indicate an integer (i.e. `integer`) it is necessary to add the suffix `L`. --- # 1.4 Create dataset Thus, inserting `1` gives a `numeric` object; explicitly inserting `1L` gives an `integer` object. -- There is also a special number `Inf`, which represents infinity. -- Allows representing entities like `1/0`. `Inf` can be used in calculations like `1/Inf`. -- The value `NaN` represents an undefined value (i.e. "not a number"; e.g. `0/0`. -- `NaN` can also be considered a missing value. --- # 1.4 Create dataset ### Data types: `numeric`/`double` ```r # create to objects number_1 <- 3.5 number_2 <- 3 # verify the data type class(number_1) ``` ``` ## [1] "numeric" ``` ```r class(number_2) ``` ``` ## [1] "numeric" ``` --- # 1.4 Create dataset ### Data types: `numeric`/`double` ```r # verify if the data type is numeric/double is.numeric(number_1) ``` ``` ## [1] TRUE ``` ```r is.numeric(number_2) ``` ``` ## [1] TRUE ``` --- # 1.4 Create dataset ### Data types: `numeric`/`double` Integers are also treated as `numeric/double`. Two functions to retain: `class()` -> returns the class or type of the object `is.numeric()` -> tests if the variable is of `numeric`/`double` type --- # 1.4 Create dataset ### Data types: `integer` Unless otherwise noted, integers are treated as `numeric` or `double` (by default). It is possible to create variables of type `integer` and convert other data types to `integer`. **Exercise** 1 - Create a variable `number_1` and set the value `5`. 2 - Check the data type of the `number_1` object through the `class()` function. 3 - Create a second variable `number_2`, use the function `as.integer()` and set the value `5`. 4 - Check the data type of the `number_2` object through the `class()` function. 5 - Use the `is.integer()` function to check the data type of `number_1` and `number_2`. --- # 1.4 Create dataset ### Data types: `integer` ```r # create the object and assign it an integer value number_1 <- 5 #check the data type class(number_1) ``` ``` ## [1] "numeric" ``` -- ```r # create another object using as.integer() *number_2 <- as.integer(5) # check data type class(number_2) ``` ``` *## [1] "integer" ``` --- # 1.4 Create dataset ### Data types: `integer` ```r # use is.integer to check if the data type is integer is.integer(number_1) ``` ``` ## [1] FALSE ``` ```r is.integer(number_2) ``` ``` ## [1] TRUE ``` --- # 1.4 Create dataset ### Data types: `character` Letters, words, and words groups are represented by the `character` data type. All `character` data must be enclosed in 'single' (`'`) or "double" (`"`) quotes. Any value enclosed in quotes will be treated as `character`. **Exercise** 1 - Create 2 variables to store someone's first (i.e. `first_name`), and last (i.e. `last_name`) names. 2 - Check the data type. 3 - Use the `is.character()` function to check the data type. --- # 1.4 Create dataset ### Data types: `character` ```r # first name first_name <- "Jorge" # last name last_name <- 'Sinval' # check data type class(first_name) ``` ``` ## [1] "character" ``` ```r class(last_name) ``` ``` ## [1] "character" ``` --- # 1.4 Create dataset ### Data types: `character` ```r # use is.character() to verify the data type is.character(first_name) ``` ``` ## [1] TRUE ``` ```r is.character(last_name) ``` ``` ## [1] TRUE ``` --- # 1.4 Create dataset ### Data types: `character` It is possible to transform any data type into `character` through the `as.character()` function. ```r # create different types of variables age <- as.integer(30) # integer score <- 9.8 # numeric/double attending_today <- TRUE # logical ``` --- # 1.4 Create dataset ### Data types: `character` ```r as.character(age) ``` ``` ## [1] "30" ``` ```r as.character(score) ``` ``` ## [1] "9.8" ``` ```r as.character(attending_today) ``` ``` ## [1] "TRUE" ``` --- # 1.4 Create dataset ### Data types: `logical` The data type `logical` can only take two values, either `TRUE` (also `T`) or `FALSE` (also `F`). This type of data is created when comparing two objects in <svg viewBox="0 0 581 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;position:relative;display:inline-block;top:.1em;fill:#384CB7;"> [ comment ] <path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"></path></svg> using logical or comparison operators. **Exercise** 1 - Create two objects `x` and `y`. 2 - Assign the values `TRUE` and `FALSE`, respectively. 3 - Use `is.logical()` to check the data type. --- # 1.4 Create dataset ### Data types: `logical` ```r # create the x and y objects x <- TRUE y <- FALSE # check data type class(x) ``` ``` ## [1] "logical" ``` ```r is.logical(y) ``` ``` ## [1] TRUE ``` .footnote[🤔 - Use `as.logical()` to turn other data types into `logical`.] --- # 1.4 Create dataset ### Data types: `logical` The result of comparison operators is always `logical`. **Exercise** 1 - Create two numeric objects. 2 - Compare these two objects with the comparison operators (ie `<`,`>`,`<=`,`>=`, `!=`, `==`)<sup>⚠️</sup> .footnote[ ⚠️ in <svg viewBox="0 0 581 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;position:relative;display:inline-block;top:.1em;fill:#384CB7;"> [ comment ] <path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"></path></svg> to test:`<=` one should use `\(<=\)`, `>=` one should use `\(>=\)`,`!=` one should use `\(!=\)`, `==` one should use `\(==\)`. ] --- # 1.4 Create dataset ### Data types: `logical` ```r # create two numeric objects x <- 3 y <- 4 # compare x with y x > y ``` ``` ## [1] FALSE ``` ```r x < y ``` ``` ## [1] TRUE ``` --- # 1.4 Create dataset ### Data types: `logical` ```r # store the result in an object z <- x > y class(z) ``` ``` ## [1] "logical" ``` --- # 1.4 Create dataset ### Data types: `logical` `TRUE` is represented by all numbers except `0`. `FALSE` is represented only and only by `0`. ```r # TRUE and FALSE are represent by 1, and 0, respectively as.logical(1) ``` ``` ## [1] TRUE ``` ```r as.logical(0) ``` ``` ## [1] FALSE ``` --- # 1.4 Create dataset ### Data types: `logical` ```r # using numbers as.numeric(TRUE) ``` ``` ## [1] 1 ``` ```r as.numeric(FALSE) ``` ``` ## [1] 0 ``` --- # 1.4 Create dataset ### Data types: `logical` ```r # with different numbers as.logical(-2, -1.5, -1, 0, 1, 2) ``` ``` ## [1] TRUE ``` --- # 1.4 Create dataset ### Data types: `logical` Use `as.logical()` to force other data types to `logical`. ```r # create different types of variables age <- as.integer(30) # integer score <- 9.8 # numeric/double attending_today <- TRUE # logical ``` --- # 1.4 Create dataset ### Data types: `logical` ```r as.logical(age) ``` ``` ## [1] TRUE ``` ```r as.logical(score) ``` ``` ## [1] TRUE ``` ```r as.logical(attending_today) ``` ``` ## [1] TRUE ``` --- # 1.4 Create dataset ### Data types: `complex` Complex numbers with real and imaginary parts. ```r w <- 1+5i class(w) ``` ``` ## [1] "complex" ``` --- # 1.4 Create dataset: Geral ## Data structures <center> <img src="assets/img/data_structures.png" width = 50%> <br> 📚 </center> .footnote[📚 Grolemund, G. (2014). _Hands-on programming with R: Write your own functions and simulations_. O’Reilly. https://doi.org/10.1017/CBO9781107415324.004] --- # 1.4 Create dataset ### Data structures: `vectors` The most basic structure of <svg viewBox="0 0 581 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;position:relative;display:inline-block;top:.1em;fill:#384CB7;"> [ comment ] <path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"></path></svg> object is a `vector`, which can **only** contain elements of the same class. **But**, like any good rule, there is an exception, lists (`list`). A list is represented as a vector, but it can contain objects of different classes. ```r a_object <- c(1,2,5,3,6,-2,4) # numeric vector b_object <- c("one","two","three") # character vector c_object <- c(TRUE,TRUE,TRUE,FALSE,TRUE,FALSE) #logical vector ``` 💡 .footnote[ 💡 The `c()` function groups elements into a vector.] --- # 1.4 Create dataset ### Data structures: `matrix` All columns of an `matrix` must have the same data type (`numeric`, `character`, etc.) and the same length. The general format is: ```r my_matrix <- matrix(1:20, #vector (in this case a numeric vector) nrow = 5, #number of rows ncol = 4, #number of columns byrow = FALSE, #fill the matrix by row or by column dimnames=list( c("row_1", "row_2", "row_3", "row_4", "row_5"), #row names c("column_1", "column_2", "column_3", "column_4"))) #column names ``` --- # 1.4 Create dataset ### Data structures: `matrix` Generating a simpler example... ```r # generate a numeric matrix 5 x 4 y <- matrix(1:20, nrow = 5, ncol = 4) #print the matrix y ``` ``` ## [,1] [,2] [,3] [,4] ## [1,] 1 6 11 16 ## [2,] 2 7 12 17 ## [3,] 3 8 13 18 ## [4,] 4 9 14 19 ## [5,] 5 10 15 20 ``` --- # 1.4 Create dataset ### Data structures: `matrix` ```r # another example cells <- c(1.32, 43.23) rows_names <- c("row_1", "row_2") columns_names <- c("column_1", "column_2") my_matrix <- matrix(cells, nrow = 2, ncol = 2, byrow = TRUE, dimnames=list(rows_names, columns_names)) ``` --- # 1.4 Create dataset ### Data structures: `matrix` _Et voilà_ 😄: ```r my_matrix ``` ``` ## column_1 column_2 ## row_1 1.32 43.23 ## row_2 1.32 43.23 ``` --- # 1.4 Create dataset ### Data structures: `arrays` The data structure `array` are similar to `matrix`, but can have more than two dimensions. ```r my_array <- array(0, dim = c(2, 2, 3)) ``` --- # 1.4 Create dataset ### Data structures: `arrays` ```r my_array ``` ``` ## , , 1 ## ## [,1] [,2] ## [1,] 0 0 ## [2,] 0 0 ## ## , , 2 ## ## [,1] [,2] ## [1,] 0 0 ## [2,] 0 0 ## ## , , 3 ## ## [,1] [,2] ## [1,] 0 0 ## [2,] 0 0 ``` --- # 1.4 Create dataset ### Data structures: `data.frame` A `data.frame` is more general than an `matrix`, as different columns can have different data types (`numeric`, `character`, etc.). Identical to the _IBM SPSS Statistics_ dataset files ```r d_object <- c(1,2,3,4) e_object <- c("red", "blue", "green", NA) f_object <- c(TRUE,TRUE,TRUE,FALSE) my_data <- data.frame(d_object, e_object, f_object) # variable names names(my_data) <- c("id","color","approved") ``` --- # 1.4 Create dataset ### Data structures: `data.frame` There are several ways to identify the elements of a `data.frame`. ```r my_data[1:2] # columns 1, and 2 of the data.frame ``` ``` ## data.frame [4, 2] ## id dbl 1 2 3 4 ## color chr red blue green NA ``` --- # 1.4 Create dataset ### Data structures: `data.frame` ```r # the columns id, and approved of the data.frame my_data[c("id","approved")] ``` ``` ## data.frame [4, 2] ## id dbl 1 2 3 4 ## approved lgl TRUE TRUE TRUE FALSE ``` ```r # the variable color of the data.frame my_data$color ``` ``` ## [1] "red" "blue" "green" NA ``` --- # 1.4 Create dataset ### Data structures: `list` A `list` is an ordered set of objects ("components"). A `list` allows you to gather a variety of objects of different types and structures (possibly unrelated) under one object. ```r # example of a list with 4 components # a string, a numeric vector, a matrix and a numberic/double value #a numeric vector a_object <- c(1,2,5,3,6,-2,4) #a matrix y <- matrix(1:20, nrow = 5, ncol = 4) w <- list(name = "Sinval", my_numbers = a_object, my_array = y, age = 32.9) ``` --- # 1.4 Create dataset ### Data structures: `list` Calling the `w` list: ``` ## $name ## [1] "Sinval" ## ## $my_numbers ## [1] 1 2 5 3 6 -2 4 ## ## $my_array ## [,1] [,2] [,3] [,4] ## [1,] 1 6 11 16 ## [2,] 2 7 12 17 ## [3,] 3 8 13 18 ## [4,] 4 9 14 19 ## [5,] 5 10 15 20 ## ## $age ## [1] 32.9 ``` --- # 1.4 Create dataset ### Data structures: `list` The elements of a list are identified with the `[[]]` convention. ```r w[[2]] # 2nd component of the list ``` ``` ## [1] 1 2 5 3 6 -2 4 ``` ```r w[["my_numbers"]] # component named "my_numbers" in the list ``` ``` ## [1] 1 2 5 3 6 -2 4 ``` --- # 1.4 Create dataset ### Data structures: `factors` Create a nominal variable (`character`), turn it into a factor. ```r # variable sex with 20 times "m" and 30 "f" sex <- c(rep("male",20), rep("female", 30)) sex <- factor(sex) # R stores sex with 20 x "1" and 30 x "2" #associates 1=female", 2="male" internally (alphabetically) # R now treats the sex variable as nominal summary(sex) ``` ``` ## female male ## 30 20 ``` --- # 1.4 Create dataset ### Data structures: `factors` A factor is an `vector` that can only contain predefined values, and is used to store categorical data. The factor stores nominal values as a `vector` of **integers** (`integer`) in the range `[1,...,k]` (where `k` is the number of unique values in the nominal variable). It is obtained an inner vector with a string of characters (the original values) mapped to these integers is obtained. --- # 1.4 Create dataset ### Data structures: `factors` An ordered factor is used to represent an ordinal variable. ```r # "categories" variable encoded as "large", "medium", "small' categories <-c(rep("large",2), rep("medium", 1), rep("small", 2)) # recode categories to 1,2,3 and # associate # 1="large", 2="medium", 3="small" *categories <- ordered (categories) categories ``` ``` *## [1] large large medium small small *## Levels: large < medium < small ``` --- # 1.4 Create dataset ### Data structures: `factors` ```r #you can also use the `factor` function categories <- factor(categories, levels = c("small","medium","large"), ordered = TRUE) # R now treats the categories variable as ordinal categories ``` ``` ## [1] large large medium small small ## Levels: small < medium < large ``` --- # 1.4 Creating data frames ### Data structures: `factors` <svg viewBox="0 0 581 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;position:relative;display:inline-block;top:.1em;fill:#384CB7;"> [ comment ] <path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"></path></svg> will treat factors as **nominal** variables and ordered factors as **ordinal** variables. You can use the options in the `factor()` and `ordered()` functions to control the mapping of integers to words (overriding alphabetical order). You can also use `factor` to create labels (`labels`) for the values. -- ```r # the "color" variable is coded with 1, 2 or 3 color <- c(1,2,3,3,2,1) # assign the following value labels # 1="red", 2="blue", 3="green" color <- factor(color, levels = c(1,2,3), labels = c("red", "blue", "green")) ``` --- # 1.4 Create dataset ### Data structures: `factors` ```r # the variable "categories" encoded with 1,3,5 categories <- c(1,3,5,5,3,1) # we want to assign the lables of values 1="low", 3="medium", 5="high" categories <- ordered(categories, levels = c(1,3,5), labels = c("low", "medium", "high")) ``` .footnote[ 🤓 - `factor`, and `ordered` they are used in the same way, with the same arguments. The first creates factors (ordered or not; `ordered=TRUE/FALSE`) and the second creates ordered factors.] --- # 1.4 Create dataset ### Summary <sup>📚</sup> -- - Variables are the blocks on which the construction of a programming language is based. -- - Variables have a reference to the memory locations that store information/data. -- - The assignment operator `<-` assigns values to a variable. -- - A variable has the following components: name, address (memory), value and data type. -- - There are rules that must be followed when assigning names to variables. .footnote[ <sup>📚</sup> Wickham, H. (2015). _Advanced R_. CRC Press. https://adv-r.hadley.nz/ ] --- # 1.4 Create dataset ### Summary - The basic data types of R are: `character`, `numeric`, `integer`, `complex`, and `logical`. -- - <svg viewBox="0 0 581 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;position:relative;display:inline-block;top:.1em;fill:#384CB7;"> [ comment ] <path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"></path></svg>'s basic data structures include `vector`, `list`, `matrix`, `data.frame` and `factor`. Some of these structures require all elements to be of the same data type (e.g. `vector`, `matrix`) while others allow multiple data types (e.g. `list`, `data.frame`). -- - Objects can have attributes such as name, dimension and class. --- # 1.4 Create dataset **<svg viewBox="0 0 581 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;position:relative;display:inline-block;top:.1em;fill:#384CB7;"> [ comment ] <path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"></path></svg> does not use nominal, ordinal, interval, and ratio terminology for data types.** -- In <svg viewBox="0 0 581 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;position:relative;display:inline-block;top:.1em;fill:#384CB7;"> [ comment ] <path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"></path></svg>, **nominal variables** can be coded as: -- `factor` ```r factor_colors <- factor("red", "green", "blue") class(factor_colors) ``` ``` ## [1] "factor" ``` -- or as `character`. ```r character_colors <- c("red", "green", "blue") class(character_colors) ``` ``` ## [1] "character" ``` --- # 1.4 Create dataset In <svg viewBox="0 0 581 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;position:relative;display:inline-block;top:.1em;fill:#384CB7;"> [ comment ] <path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"></path></svg>, **ordinal variables** can be coded as: -- `factor` ```r categories_ord <- factor(c("bad", "good", "more or less"), levels = c("bad", "more or less","good"), ordered = TRUE) class(categories_ord) ``` ``` ## [1] "ordered" "factor" ``` ```r categories_ord ``` ``` ## [1] bad good more or less ## Levels: bad < more or less < good ``` --- # 1.4 Create dataset or as `ordered` ```r ordered_ranked <- ordered(c(3,1,2), levels = c(1,2,3), labels = c("-", "+/-", "+")) class(ordered_ranked) ``` ``` ## [1] "ordered" "factor" ``` ```r ordered_ranked ``` ``` ## [1] + - +/- ## Levels: - < +/- < + ``` --- # 1.4 Create dataset The **quantitative interval or ratio** variables can be coded as variables such as `numeric` or `integer`. -- If an `L` is placed after the number (i.e. X`L`), <svg viewBox="0 0 581 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;position:relative;display:inline-block;top:.1em;fill:#384CB7;"> [ comment ] <path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"></path></svg> will create an `integer` -- ```r num_classes_int <- c(1L, 2L, 3L, 4L, 5L) class(num_classes_int) ``` ``` ## [1] "integer" ``` -- or via the `as.integer` function ```r num_classes_int <- as.integer(c(1, 2, 3, 4, 5)) class(num_classes_int) ``` ``` ## [1] "integer" ``` --- # 1.4 Create dataset Otherwise, it will always consider the `numeric` data type -- ```r num_classes <- c(1, 2, 3, 4, 5) class(num_classes) ``` ``` ## [1] "numeric" ``` --- # 1.4 Create dataset Some useful functions: - `head()` - display the first 6 lines -- - `tail()` - display the last 6 lines -- - `dim()` - displays the dimension of an object (i.e. `data.frame`: number of rows, and number of columns) -- - `nrow()` - number of rows -- _Continue..._ --- # 1.4 Create dataset Some useful functions (continued): - `ncol()` - number of columns -- - `str()` - displays the structure of an object: name, type and brief preview of data in each column -- - `names()` or `colnames()` - both show the names of of an object -- - `sapply(our_data_frame, class)` - display the data class in each database column --- # 1.5 Packages Some packages come installed with <svg viewBox="0 0 581 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;position:relative;display:inline-block;top:.1em;fill:#384CB7;"> [ comment ] <path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"></path></svg> (`r-base`) (eg `base`, `stats`, `utils`).They provide functions for some essential tasks (e.g. import/export data, descriptive statistics, tables, and statistical tests). There are loads of additional packages that can be **installed for free**. -- Some essential functions for **packages**: -- - See which packages are installed: `library()` -- - View which packages are loaded in the environment: `search()` -- - Install: `install.packages("package_name")` -- - Load: `library(package_name)` -- <center>  --- class: center, bottom, inverse # More info -- Slides created with the <svg viewBox="0 0 581 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;position:relative;display:inline-block;top:.1em;fill:#384CB7;"> [ comment ] <path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"></path></svg> package [`xaringan`](https://github.com/yihui/xaringan). -- <svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;fill:currentColor;position:relative;display:inline-block;top:.1em;"> <g label="icon" id="layer6" groupmode="layer"> <path id="path2" d="M 132.62426,316.69067 C 119.2805,301.94483 112.56962,274.5073 112.56962,234.39862 v -54.79191 c 0,-37.32217 -5.81677,-63.58084 -17.532347,-78.83466 -11.6757,-15.293118 -31.159702,-22.922596 -58.353466,-22.922596 -5.958581,0 -11.409226,0.22492 -16.45319,0.5917 -5.04455,0.427121 -9.742846,1.037046 -14.1564111,1.83092 V 95.057199 H 16.671281 c 12.325533,0 20.908335,3.82414 25.667559,11.532201 4.77973,7.74964 7.139712,25.48587 7.139712,53.14663 v 68.01321 c 0,42.12298 13.016861,74.19672 39.233939,96.16314 19.627549,16.47424 46.636229,27.23363 81.030059,32.40064 v -20.17708 c -16.3928,-4.27176 -29.04346,-10.51565 -37.11829,-19.44413 z m 246.75144,0 c 13.34377,-14.74584 20.05466,-42.18337 20.05466,-82.29205 v -54.79191 c 0,-37.32217 5.81673,-63.58084 17.53235,-78.83466 11.67568,-15.293118 31.15971,-22.922596 58.35348,-22.922596 5.95858,0 11.40922,0.22492 16.45315,0.5917 5.04457,0.427121 9.74287,1.037046 14.15645,1.83092 v 14.785125 h -10.59712 c -12.32549,0 -20.90826,3.82414 -25.66752,11.532201 -4.77974,7.74964 -7.13972,25.48587 -7.13972,53.14663 v 68.01321 c 0,42.12298 -13.01688,74.19672 -39.23394,96.16314 -19.6275,16.47424 -46.63622,27.23363 -81.03006,32.40064 v -20.17708 c 16.39279,-4.27176 29.04347,-10.51565 37.11827,-19.44413 z M 303.95857,87.165762 c 8.42049,-6.691524 25.52576,-10.536158 51.23486,-11.492333 V 63.999997 H 156.80716 v 11.673432 c 26.1755,0.956175 43.38268,4.800809 51.68248,11.492333 8.31852,6.73139 12.40691,20.033568 12.40691,39.904818 V 384.6851 c 0,20.80641 -4.08839,34.5146 -12.40691,41.02332 -8.2998,6.56905 -25.50698,10.10729 -51.68248,10.65744 V 448 h 197.71597 l 0.67087,-11.63414 c -25.50471,-0.54955 -42.56835,-4.35266 -51.07201,-11.40918 -8.4182,-6.95638 -12.73153,-20.44184 -12.73153,-40.27158 V 127.07058 c 0,-19.87125 4.16983,-33.173428 12.56922,-39.904818 z" style="stroke-width:0.0753388"></path> </g></svg> + <svg viewBox="0 0 581 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;position:relative;display:inline-block;top:.1em;fill:#384CB7;"> [ comment ] <path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"></path></svg> = <svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;position:relative;display:inline-block;top:.1em;fill:red;"> [ comment ] <path d="M462.3 62.6C407.5 15.9 326 24.3 275.7 76.2L256 96.5l-19.7-20.3C186.1 24.3 104.5 15.9 49.7 62.6c-62.8 53.6-66.1 149.8-9.9 207.9l193.5 199.8c12.5 12.9 32.8 12.9 45.3 0l193.5-199.8c56.3-58.1 53-154.3-9.8-207.9z"></path></svg> -- <svg viewBox="0 0 581 512" xmlns="http://www.w3.org/2000/svg" style="height:1em;position:relative;display:inline-block;top:.1em;fill:#384CB7;"> [ comment ] <path d="M581 226.6C581 119.1 450.9 32 290.5 32S0 119.1 0 226.6C0 322.4 103.3 402 239.4 418.1V480h99.1v-61.5c24.3-2.7 47.6-7.4 69.4-13.9L448 480h112l-67.4-113.7c54.5-35.4 88.4-84.9 88.4-139.7zm-466.8 14.5c0-73.5 98.9-133 220.8-133s211.9 40.7 211.9 133c0 50.1-26.5 85-70.3 106.4-2.4-1.6-4.7-2.9-6.4-3.7-10.2-5.2-27.8-10.5-27.8-10.5s86.6-6.4 86.6-92.7-90.6-87.9-90.6-87.9h-199V361c-74.1-21.5-125.2-67.1-125.2-119.9zm225.1 38.3v-55.6c57.8 0 87.8-6.8 87.8 27.3 0 36.5-38.2 28.3-87.8 28.3zm-.9 72.5H365c10.8 0 18.9 11.7 24 19.2-16.1 1.9-33 2.8-50.6 2.9v-22.1z"></path></svg> has infinite possibilities. -- Practice is the best strategy for learning. -- . -- _In God we trust, all others bring data_ -- Edwards Deming -- . -- . -- . -- THE END --- class: center, bottom, inverse 