R/exercise_1_4.R

Defines functions exercise_1_4

Documented in exercise_1_4

#' 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)
}
JonasEngstrom/prexRiswr documentation built on Dec. 18, 2021, 1:41 a.m.