Data manipulation
Data manipulation involves the process of transforming and modifying data to extract useful information or prepare it for analysis. This can include tasks such as filtering rows, selecting columns, creating new variables, aggregating data, and joining datasets. The dplyr package in R is a powerful tool for data manipulation tasks.
Filtering Rows: Selecting rows based on certain conditions.
# Load the dplyr package
library(dplyr)
# Filter cars with mpg greater than 30
filtered_cars <- mtcars %>%
filter(mpg > 30)
head(filtered_cars)
Output:
mpg cyl disp hp drat wt qsec vs am gear carb
Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1
Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2
Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1
Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2
How To Start Programming With R
R Programming Language is designed specifically for data analysis, visualization, and statistical modeling. Here, we’ll walk through the basics of programming with R, from installation to writing our first lines of code, best practices, and much more.
Table of Content
- 1. Installation
- 2. Variables and Data Types
- 3. Control Structures
- 4. Functions in R
- 5. Pre-built datasets in R
- 6. Data Analysis and Visualization with R
- 7. Data Analysis and Visualization with Packages
- 8. Exploring Shiny
- Conclusion