3. r-squared
Slide 3
Working With Data
www.r-squared.in/rprogramming
✓ Data Types
✓ Data Structures
✓ Data Creation
✓ Data Info
✓ Data Subsetting
✓ Comparing R Objects
✓ Importing Data
✓ Exporting Data
✓ Data Transformation
✓ Numeric Functions
✓ String Functions
✓ Mathematical Functions
4. r-squared
Slide 4
Data Transformation
www.r-squared.in/rprogramming
In this section, we will explore built-in R function that can be used for
transforming/reshaping data. This section is further divided into 4 sub-sections:
● Reorder Data
● Subset/Filter Data
● Combine Data
● Transform Data
5. r-squared
Slide 5
Reorder Data
www.r-squared.in/rprogramming
In the course of analyzing data, sometimes it is necessary to reorder the data as we
cannot use the data in its original format. Sorting the data is the best example of such
reordering. In this section, we will learn the following functions:
✓ t (transpose)
✓ order
✓ sort
✓ rank
58. r-squared
Slide 58
by()
www.r-squared.in/rprogramming
Examples
> # example 1
> by(mtcars$mpg, mtcars$cyl, summary)
mtcars$cyl: 4
Min. 1st Qu. Median Mean 3rd Qu. Max.
21.40 22.80 26.00 26.66 30.40 33.90
----------------------------------------------------------------
mtcars$cyl: 6
Min. 1st Qu. Median Mean 3rd Qu. Max.
17.80 18.65 19.70 19.74 21.00 21.40
----------------------------------------------------------------
mtcars$cyl: 8
Min. 1st Qu. Median Mean 3rd Qu. Max.
10.40 14.40 15.20 15.10 16.25 19.20
59. r-squared
In the next unit, we will explore the following numeric functions:
Slide 59
Next Steps...
www.r-squared.in/rprogramming
● signif()
● jitter()
● format()
● formatC()
● abs()
● round()
● ceiling()
● floor()