R/ESCS.R

Defines functions get_ESCS

Documented in get_ESCS

#' @title get_ESCS
#' @description Esta es una funcion de PFSkit
#' @details Esta funcion es parte del paquete PFS-kit
#' @examples
#' -------
#' @export
get_ESCS<-function(Q_booklet){
  #Getting HOMEPOS
  HOMEPOS_data <- get_HOMEPOS(Q_booklet)
  #Getting HISEI
  HISEI_data <- get_HISEI()
  #Getting PARED
  PARED_data <- get_PARED(Q_booklet)

  #ESCS calculation by student
  knotion_students_ESCS_HISEI_PARED_HOMEPOS <-
    HOMEPOS_data %>%
    left_join(HISEI_data %>%
                select(stidstd, HISEI)) %>%
    left_join(PARED_data %>%
                select(stidstd, PARED)) %>%
    mutate(
      HISEI_norm = (HISEI - 51.5) / 21.98,
      PARED_norm = (PARED - 13.85) / 3.08,
      ESCS = ((0.85 * HISEI_norm) +
                (0.85 * PARED_norm) +
                (0.8 * HOMEPOS)) / 1.915
    ) %>%
    select(stidstd,everything())
}
# dataproc<-get_ESCS(data2)
# compar<-inner_join(dataproc %>%
#                      select(stidstd,ESCS),
#                    data %>%
#                      select(stidstd,ESCS),
#                    by=c("stidstd"="stidstd"))%>%
#   mutate(diff=abs(ESCS.x-ESCS.y))
# compar<-compar[,order(colnames(compar))]
knotion/PFSkit documentation built on Feb. 12, 2020, 12:16 p.m.