ejemplo.R

#
#
# Estoy limpiando:
#  - desc_num: parece MEDIO limpio
#      - Comprobar que no se rompe con niveles vacĂ­os
#      - Comprobar que puede devolver NA
#      - Encajarlo en data.frame
#
#
#  - FALTAN COMPARACIONES APAREADAS!!!
#
#
#
#
#


feR::desc_num(mtcars$mpg)

feR::describe(mtcars$mpg, mtcars$cyl)

d <- feR::describe(mtcars$mpg, mtcars$cyl)



feR::desc.num(mtcars$mpg, mtcars$cyl)



DATOS <- feR::feRdata

DATOS$UNO <- factor(1)


feR::describe(DATOS$age)




feR::describe(feR::feRdata$age, feR::feRdata$sex)

feR::describe(feR::feRdata$sex)

feR::describe(feR::feRdata$sex, feR::feRdata$blond)


feR::compare(feR::feRdata$age, feR::feRdata$sex)


feR::compare(feR::feRdata$blond, feR::feRdata$sex)
feR::compare(feR::feRdata$health, feR::feRdata$sex)
feR::compare(feR::feRdata$blond, feR::feRdata$health)
c <- feR::compare(mtcars$am, mtcars$vs)






f <- feR:::.describe.feR_math.factor(feRdata$sex, feRdata$blond)


feR:::.guess.factor(feR::feRdata$age)

f <- feR::compare(feR::feRdata$age, feR::feRdata$blond)
fable(f)




f <- feR::describe(feR::feRdata$sex, feR::feRdata$blond)
f1 <- fable(f, padding = 0)

f2 <- feR::compare(feR::feRdata$sex, feR::feRdata$blond)
f2




f2 <- feR::describe(feR::feRdata$sex)
f3 <- feR::fable(f2)

f3
rownames(as.matrix(feRdata))
rownames(as.matrix(mtcars))


fable.add.column(feRdata,1,pos = 2)
fable.add.row(feRdata,1,pos = 2)


feR::add.column(feRdata,11111, pos = 2)
feR::add.column(mtcars,11111, pos = 2)

feR::add.row(feRdata,11111, pos = 2)
feR::add.row(mtcars,11111, pos = 2)

t <- feR::fable(mtcars[1:4,1:4], align = "center", DEBUG = F)
t

t2 <- feR::fable.add.col(t,c("Type of shift","Automatic","","Manual",""), pos = 0)
t2
feR:::.fable.set.lines.col(t2,pos = 1,lines = c("b","","b","",""))


feR::fable.add.col(t,999, pos = 2)
feR::fable.add.row(t,999, pos = 2)





feR::ANOVA(feR::feRdata$age, feR::feRdata$health)
feR::KW(feR::feRdata$age, feR::feRdata$health)

feR::describe(feRdata)

feR::describe(feRdata$age, feRdata$sex)


feR:::.describe.numeric(feRdata$age)
feR::desc.num(feRdata$age)


for (var in names(feRdata)) {
  values = dplyr::pull(feRdata,var)
  if (is.numeric(values)) print(feR::describe(values,x.name = var, y = feRdata$sex, y.name = "sex"))
}

feR::compare(DATOS$age, y = DATOS$sex)

rm(list = ls())

t <- feR:::.fable.constructor(mtcars[12:20,1:3])
t

tt <- feR::fable(mtcars[1:3,1:5], DEBUG=F)
t2 <- feR::fable.add.row(tt, row_data = c("algo",""))
t2

class(t2)

(t <- feR::fable(mtcars[1:3,1:5], DEBUG=F))
feR::fable.add.col(t,999, pos = 2, DEBUG = T)
feR::fable.add.row(t,999, pos = 2, DEBUG = T)



t2 <- feR::fable.add.header(t,dimnames(t)[[2]])
feR::fable.add.header(t,dimnames(t)[[2]], row =2)
t2
(t3 <- feR:::.add_row_sep(t2, row=2))
t3

DATOS <- feR::feRdata

feR::describe(DATOS$sex)

(c <- feR:::.describe.factor(DATOS$sex, y=DATOS$blond))
(c1 <- feR:::.describe.factor(DATOS$sex))


feR:::.describe.feR_math.factor(data$TYPE, y=data$TYPE, total.by.row = T, total.by.column = T)






feR::describe(data_$empty, show.na = FALSE)
feR::describe(data_$age)
feR::describe(data_$age, x.name = "ADAF")

feR::describe(data_$age, x.name = "asf", y = data_$sex, DEBUG = FALSE)

feR::describe(data_$sex)
feR::describe(data_, y = data_$blond)
feR::describe(data_$sex, y = data_$blond)
feR::describe(data_$age, y = data_$sex, show.general = TRUE)

feR::welch_test(data_$age, y = data_$sex, lang = "es")



c <- feR::compare(data_$age, y = data_$sex)

feR::compare(data_, y = data_$sex)

c <- feR::compare(runif(34), y = data_$sex, show.desc = T)


feR:::.check.comp_means.parameters()
mean(data_$age)
is.data.frame(data_$age)

library(feR)

feR::medias(data_$age, decimals = 4)
feR::medias(data_$sex, decimals = 4)
feR::medias(data_$age[1:10], by = data_$sex, decimals = 4)
feR::medias(data_$HEALTH, by = data_$sex, decimals = 4)



feR::medias(data_, "age", by = "sex", show.interpretation =T, show.global = F)
feR::medias(data_, "age", by = "HEALTH", show.interpretation =T, show.global = F)
feR::medias(data_, "age", by = "sex", show.interpretation =T, show.global = F, comp = T)
feR::medias(data_, "age", by = "sex", show.interpretation =T, show.global = F, comp = T)
feR::comp.media(data_, "age", by = "sex", DEBUG.FORMA = T, DEBUG.CALL = T)
feR::comp.media(data_$age, by = data_$sex, DEBUG.FORMA = T, DEBUG.CALL = T)

feR::comp.media(data_, "age", by = "HEALTH")
feR::comp.media(data_, "age", by = "HEALTH", show.interpretation = T, show.global = F, show.desc = F)
feR::comp.media(data_[1:6,], "age", by = "HEALTH", show.interpretation =T, show.global = F, show.desc = F)

feR::medias(data_[1:6,], "age", by = "HEALTH", show.interpretation =T, show.global = F, show.desc = T, DEBUG.CALL = F, comp = T)


PRUEBAS.UDAIC.MEDIA = FALSE
if (PRUEBAS.UDAIC.MEDIA){
  # udaic.media("age", DEBUG=TRUE)
  # udaic.media(data_, "age", DEBUG=TRUE)
  # udaic.media(data_, "age", "HEIGHT", DEBUG=TRUE)
  udaic.media(data_, by = "sex", data_$age, DEBUG=TRUE)
  udaic.media(data_$age)
  c <- udaic.media(data_, by = "sex", data_$age, data_$HEALTH, "BLOND", DEBUG=TRUE)
  udaic.media(data_, by = "sex", c("age", "HEIGHT"), DEBUG=TRUE)
  udaic.media(data_, by = c("sex","BLOND"), c("age", "HEIGHT"), DEBUG=FALSE)
}



#----------------------------------------------------------------------------------- FORMA.DATOS

PRUEBAS.FORMA.DATOS = FALSE
if (PRUEBAS.FORMA.DATOS){
  forma.datos(by = "sex", "age", DEBUG=TRUE)
  forma.datos(data_, by = "sex", data_$age, DEBUG=TRUE)
  c <- forma.datos(data_, by = "sex", data_$age, data_$HEALTH, "BLOND", DEBUG=TRUE)
  forma.datos(data_, by = "sex", c("age", "HEIGHT"), DEBUG=TRUE)
  forma.datos(data_, by = c("sex","BLOND"), c("age", "HEIGHT"), DEBUG=TRUE)
}

#----------------------------------------------------------------------------------- CALLS
prueba.call <- function(..., by=NULL, DEBUG = FALSE, DEBUG.CALL = FALSE) {
  forma.datos(..., by = by, DEBUG = DEBUG, DEBUG.CALL = DEBUG.CALL)
}
PRUEBAS.CALL = FALSE
if (PRUEBAS.CALL){
  prueba.call(by = "sex", "age", DEBUG.CALL=TRUE)
  prueba.call(data_, by = "sex", data_$age, DEBUG.CALL=TRUE, DEBUG=TRUE)
  prueba.call(data_, by = "sex", data_$age, data_$HEALTH, "BLOND", DEBUG.CALL=TRUE, DEBUG = TRUE)
  prueba.call(data_, by = "sex", c("age", "HEIGHT"), DEBUG.CALL=TRUE, DEBUG = TRUE)
  prueba.call(data_, by = c("sex","BLOND"), c("age", "HEIGHT"), DEBUG.CALL=TRUE, DEBUG = TRUE)
  prueba.call(data_, by = c("sex","BLOND"), "age", "HEIGHT", DEBUG.CALL=TRUE, DEBUG = TRUE)
}
feranpre/feR documentation built on Nov. 22, 2022, 2:29 a.m.