--5-Utilities

#1-Useful Functions

# mean()
# abs()
# round()
# sum()
# seq()
# rep()
# is.*()---> output: TRUE or FALSE
# as.*()--> define the object of variable
# append()
# rev()

#2-Mathematical utilities

# Have another look at some useful math functions that R features: 
# abs(): Calculate the absolute value.
# sum(): Calculate the sum of all the values in a data structure.
# mean(): Calculate the arithmetic mean.
# round(): Round the values to 0 decimal places by default. 
#Try out ?round in the console for variations of round() and
# ways to change the number of digits to round to.

#Calculate the sum of the absolute rounded values of the training errors. 
#You can work in parts, or with a single one-liner. 
#There's no need to store the result in a variable, just have R print it.

# The errors vector has already been defined for you
errors <- c(1.9, -2.6, 4.0, -9.5, -3.4, 7.3)

# Sum of absolute rounded values of errors
sum(abs(round(errors)))

#3-Find the error

#4-Data Utilities

#5-Find the error (2)

#6-Beat Gauss using R

#7-Regular Expressions

#8-grepl & grep

#9-grepl & grep (2)

#10-sub & gsub

#11-sub & gsub (2)

#12-Times and Dates

#13-Right here, right now

#14-Create and format dates

#15-Create and format times

#16-Calculations with Dates

#17-Calculations with Times

#18-Time is of the essence

Last updated