Learn to manipulate numbers in R using the built in numeric functions. This tutorial is part of the Working With Data module of the R Programming course offered by r-squared.
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
In this unit, we will explore the following numeric functions:
Slide 4
Numeric Functions
www.r-squared.in/rprogramming
● signif()
● jitter()
● format()
● formatC()
● abs()
● round()
● ceiling()
● floor()
14. r-squared
Slide 14
trunc()
www.r-squared.in/rprogramming
Examples
> # example 1
> x <- 5.3645
> trunc(x)
[1] 5
# as we truncate the value in x towards zero, the first integer that appears is 5.
> # example 2
> x <- -3.94
> trunc(x)
[1] -3
> round(x)
[1] -4
> floor(x)
[1] -4
# as we truncate the value in x towards zero, the first integer that appears is -3.
24. r-squared
In the next unit, we will explore string manipulation in R using the following functions:
Slide 24
Next Steps...
www.r-squared.in/rprogramming
● match()
● char.expand()
● grep()
● grepl()
● sub()
● substr()
● substring()
● strsplit()
● strtrim()
● chartr()
● tolower()
● toupper()
● toString()
● nchar()
● nzchar()
● noquote()
● pmatch()
● charmatch()
25. r-squared
Slide 25
Connect With Us
www.r-squared.in/rprogramming
Visit r-squared for tutorials
on:
● R Programming
● Business Analytics
● Data Visualization
● Web Applications
● Package Development
● Git & GitHub