Lecture: Inductive Statistical Methods
Požadavky na absolvování
Descriptive Statistics
Once loaded, the dataset is listed in the Environment pane on the top right side of the RStudio. You may investigated several properties of the dataset there (number of observation, list of variables).
- Several other ways to view the whole dataset (be aware for large datasets!):
## # A tibble: 8 x 3
## student gpa ACT
## <dbl> <dbl> <dbl>
## 1 1 2.8 21
## 2 2 3.4 24
## 3 3 3 26
## 4 4 3.5 27
## 5 5 3.6 29
## 6 6 3 25
## 7 7 2.7 25
## 8 8 3.7 30
## # A tibble: 6 x 3
## student gpa ACT
## <dbl> <dbl> <dbl>
## 1 1 2.8 21
## 2 2 3.4 24
## 3 3 3 26
## 4 4 3.5 27
## 5 5 3.6 29
## 6 6 3 25
- To list the variables
## [1] "student" "gpa" "ACT"
- To access a particular variable, try first
## Error in eval(expr, envir, enclos): object 'gpa' not found
This does not work: the variable cannot be accessed directly, without specifying the dataset.
## [1] 2.8 3.4 3.0 3.5 3.6 3.0 2.7 3.7
## [1] 3.4
- But we may work directly with variables once the dataset is attached
## [1] 2.8 3.4 3.0 3.5 3.6 3.0 2.7 3.7
## [1] 3.4
- Some ways to restrict data to work with
## # A tibble: 5 x 3
## student gpa ACT
## <dbl> <dbl> <dbl>
## 1 1 2.8 21
## 2 2 3.4 24
## 3 3 3 26
## 4 4 3.5 27
## 5 5 3.6 29
## # A tibble: 4 x 3
## student gpa ACT
## <dbl> <dbl> <dbl>
## 1 2 3.4 24
## 2 4 3.5 27
## 3 6 3 25
## 4 8 3.7 30
## # A tibble: 4 x 3
## student gpa ACT
## <dbl> <dbl> <dbl>
## 1 3 3 26
## 2 4 3.5 27
## 3 5 3.6 29
## 4 8 3.7 30
## [1] 3.0 3.5 3.6 3.7
## [1] 3.0 3.5 3.6 3.7
The general subseting function
## # A tibble: 4 x 2
## student gpa
## <dbl> <dbl>
## 1 3 3
## 2 4 3.5
## 3 5 3.6
## 4 8 3.7
- If the direct access is not further needed, detach the dataset
(The dataset is detached automatically when closing RStudio.)