#' ISWR exercise 1.4
#'
#' @description Solution to exercise 1.1 from Basics in Dalgaard P. Introductory statistics
#' with R. New York : Springer; 2008.
#'
#' @description “What happens if you change the levels of a factor (with `levels`)
#' and give the same value to two or more levels?”
#'
#' @return Does not return.
#' @export
#'
#' @examples
#' exercise_1_4()
exercise_1_4 <- function() {
a <- factor(c(1,2,3,4))
print(a)
levels(a) <- c(1,2,3,2)
print(a)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.