knitr::opts_chunk$set(
  echo=FALSE,
  message=FALSE,
  warning=FALSE
)

CorTable

This is a correlation table. It looks like this:

d <- mtcars[,1:5]
corr <- furniture::tableC(d)
CorTable(
  dataset = d,
  table = corr,
  caption = "Test table with mtcars dataset"
)

And there you have it. That's a correlation table.

texregBetter

This is what texregBetter looks like:

walkingImp <- mice::mice(
  mice::walking,
  m=5,
  maxit=5,
  meth='pmm',
  print=FALSE
)
m1 <- with(walkingImp,lm(walkingImp$data$age~walkingImp$data$sex+walkingImp$data$YA))
m2 <- with(walkingImp,lm(walkingImp$data$age~walkingImp$data$sex+walkingImp$data$YB))
mList <- list(
  m1,
  m2
)
coefNamesSquare <- sapply(
  mList,
  function(m){
    sapply(
      1:length(m$analyses),
      function(i)
        names(m$analyses[[i]]$coefficients)
    )
  }
)
coefNames <- c()
for(i in 1:ncol(coefNamesSquare))
  coefNames <- c(
    coefNames,
    coefNamesSquare[,i]
  )
coefNames <- gsub("^.+\\$","",unique(coefNames))
texregBetter(
  l = lapply(mList,mice::pool),
  labels = coefNames,
  caption = "texregBetter"
)

texregBetterGlm

This is what texregBetterGlm looks like:

m1 <- with(walkingImp,glm(walkingImp$data$age~walkingImp$data$sex+walkingImp$data$YA))
m2 <- with(walkingImp,glm(walkingImp$data$age~walkingImp$data$sex+walkingImp$data$YB))
mList <- list(
  m1,
  m2
)
coefNamesSquare <- sapply(
  mList,
  function(m){
    sapply(
      1:length(m$analyses),
      function(i)
        names(m$analyses[[i]]$coefficients)
    )
  }
)
coefNames <- c()
for(i in 1:ncol(coefNamesSquare))
  coefNames <- c(
    coefNames,
    coefNamesSquare[,i]
  )
coefNames <- gsub("^.+\\$","",unique(coefNames))
texregBetter(
  l = lapply(mList,mice::pool),
  labels = coefNames,
  caption = "texregBetterGlm"
)

And there it is.



Jenna-Cassinat/ApaTable documentation built on Oct. 31, 2022, 5:55 a.m.