write.result | R Documentation |
This function writes the results of a misty object (misty.object
)
into a Excel file.
write.result(x, file = "Results.xlsx", tri = x$args$tri,
digits = x$args$digits, p.digits = x$args$p.digits,
icc.digits = x$args$icc.digits, check = TRUE)
x |
misty object ( |
file |
a character string naming a file with or without file extension
'.xlsx', e.g., |
tri |
a character string or character vector indicating which triangular
of the matrix to show on the console, i.e., |
digits |
an integer value indicating the number of decimal places digits to be used for displaying results. |
p.digits |
an integer indicating the number of decimal places to be used for displaying p-values. |
icc.digits |
an integer indicating the number of decimal places to be used for displaying intraclass correlation coefficients. |
check |
logical: if |
Currently the function supports result objects from the function
cor.matrix
, crosstab
, freq
,
item.alpha
, item.cfa
, item.invar
,
item.omega
, result.lca
, multilevel.cfa
,
multilevel.cor
, multilevel.descript
, multilevel.fit
,
multilevel.invar
, multilevel.omega
, na.coverage
,
na.descript
, na.pattern
, robust.coef
, std.coef
.
Takuya Yanagida takuya.yanagida@univie.ac.at
cor.matrix
, crosstab
, freq
,
item.alpha
, item.cfa
, item.invar
,
item.omega
, result.lca
, multilevel.cfa
,
multilevel.cor
, multilevel.descript
, multilevel.fit
,
multilevel.invar
, multilevel.omega
, na.coverage
,
na.descript
, na.pattern
, robust.coef
, std.coef
,
## Not run:
#--------------------------------------
# cor.matrix() function
result <- cor.matrix(mtcars, print = "all", output = FALSE)
write.result(result, "Correlation.xlsx")
#--------------------------------------
# crosstab() function
result <- crosstab(mtcars[, c("carb", "gear")], print = "all", output = FALSE)
write.result(result, "Crosstab.xlsx")
#--------------------------------------
# descript() function
result <- descript(mtcars, output = FALSE)
write.result(result, "Descript.xlsx")
#--------------------------------------
# freq() function
result <- freq(mtcars, exclude = 99, output = FALSE)
write.result(result, "Freq.xlsx")
#--------------------------------------
# item.alpha() function
result <- item.alpha(attitude, output = FALSE)
write.result(result, "Alpha.xlsx")
#--------------------------------------
# item.cfa() function
# Load data set "HolzingerSwineford1939" in the lavaan package
data("HolzingerSwineford1939", package = "lavaan")
result <- item.cfa(HolzingerSwineford1939[, c("x1", "x2", "x3")],
output = FALSE)
write.result(result, "CFA.xlsx")
#--------------------------------------
# item.omega() function
result <- item.omega(attitude, output = FALSE)
write.result(result, "Omega.xlsx")
#--------------------------------------
# multilevel.cor() function
# Load data set "Demo.twolevel" in the lavaan package
data("Demo.twolevel", package = "lavaan")
result <- multilevel.cor(Demo.twolevel[, c("y1", "y2", "y3")],
cluster = Demo.twolevel$cluster, output = FALSE)
write.result(result, "Multilevel_Correlation.xlsx")
#--------------------------------------
# multilevel.descript() function
# Load data set "Demo.twolevel" in the lavaan package
data("Demo.twolevel", package = "lavaan")
result <- multilevel.descript(Demo.twolevel[, c("y1", "y2", "y3")],
cluster = Demo.twolevel$cluster, output = FALSE)
write.result(result, "Multilevel_Descript.xlsx")
#--------------------------------------
# na.coverage() function
dat <- data.frame(x = c(1, NA, NA, 6, 3),
y = c(7, NA, 8, 9, NA),
z = c(2, NA, 3, NA, 5))
result <- na.coverage(dat, output = FALSE)
write.result(result, "NA_Coverage.xlsx")
#--------------------------------------
# na.descript() function
dat <- data.frame(x1 = c(1, NA, 2, 5, 3, NA, 5, 2),
x2 = c(4, 2, 5, 1, 5, 3, 4, 5),
x3 = c(NA, 3, 2, 4, 5, 6, NA, 2),
x4 = c(5, 6, 3, NA, NA, 4, 6, NA))
result <- na.descript(dat, table = TRUE, output = FALSE)
write.result(result, "NA_Descriptives.xlsx")
#--------------------------------------
# na.pattern() function
dat <- data.frame(x = c(1, NA, NA, 6, 3),
y = c(7, NA, 8, 9, NA),
z = c(2, NA, 3, NA, 5))
result <- na.pattern(dat, output = FALSE)
write.result(result, "NA_Pattern.xlsx")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.