Skip to content

Commit

Permalink
des.tab has two True/False arguments for reverse check
Browse files Browse the repository at this point in the history
  • Loading branch information
masiraji committed Nov 18, 2022
1 parent 6737759 commit 6d7d62b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 9 additions & 3 deletions R/des.tab.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,30 @@
#'data <- tabledown::Rotter[, 11:31]
#'table <- des.tab(data)
#' @param df A data frame.
#' @param reverse If TRUE, will provide indicate which items had a negative correlation and reverse them
#'
#'@return
#'Returns a summary table of descriptives in a data frame structure.

#' @export
des.tab <- function(df){
des.tab <- function(df, reverse = FALSE){

Descriptives <- psych::describe(df)
Mean <-MOTE::apa(Descriptives$mean,2,TRUE)
SD <-MOTE::apa(Descriptives$sd,2,TRUE)
Skew <-MOTE::apa(Descriptives$skew,2,TRUE)
Kurtosis <- MOTE::apa(Descriptives$kurtosis,2,TRUE)
ifelse(reverse==TRUE,{
alpha <- psych::alpha(df,check.keys=TRUE)
},
{alpha <- psych::alpha(df,check.keys=FALSE)})
Items <- rownames(alpha$item.stats)
Corrected.item.total.correlation <- MOTE::apa(alpha$item.stats$r.cor,2,TRUE)
normality.test <-normality.loop(df)
statistics <-MOTE::apa(normality.test$statistic,2,TRUE)
sig <-(normality.test$significance)
Normality <- paste(statistics, sig, sep = "" )
des.tab <-as.data.frame((cbind(Items, Mean, SD, Skew,Kurtosis, Normality,Corrected.item.total.correlation)))
des.tab
des.tab}


}
4 changes: 3 additions & 1 deletion man/des.tab.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6d7d62b

Please sign in to comment.