Suppressing warnings
A warning tells the user that something has gone potentially wrong. Let's highlight a good use of the warning function.
This exercise is part of the course
Defensive R Programming
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create new variable
x <- c(___, ___, ___)
y <- 1:3
# Correlation coefficient of x & y
m <- cor(___, ___)