lisrelToR/0000755000175100001440000000000012142463423012210 5ustar hornikuserslisrelToR/MD50000644000175100001440000000145312142463423012523 0ustar hornikuserse97edd27e18b9b75b31b0d726ff23eac *DESCRIPTION 6021537c34ea56c189831124f714d415 *NAMESPACE 8b6f6ea99d17410c3ab5b4ba58870c88 *NEWS 1594fe2761635b6b88ae7874d512b690 *R/findCov.R 3e24e4007bc4933ee3abf3087da76e4a *R/findFit.R 18a12f8985a4e11c3c93149c8e8d6144 *R/findMatrix.R e90b3044e04d6af36b5983b7f5d14e1c *R/getMatrix.R 3a93c4b61a5c21be5707007fa66d0bdc *R/lisrelMatrix.R ab0c8788239cbb49eb6d96cc6d8584e2 *R/matRange.R 528aca9870d62375c05f38ba45a80cf4 *R/methods.R 78f66e693934e5415605aef1ed67bc26 *R/readLisrel.R 8e878ca6e62bc94869ac46313cc32326 *R/zzz.R 674b1932685f6dea47a525a3a4cd5c46 *README.md b30c270e14ecfeaba17ab5e3a3db2c4e *man/lisrelMatrix.Rd 08b086ffc986ff7316457be6554fa097 *man/lisrelToR-package.Rd 93f933ddd3c0f83a01aadbd78263a159 *man/methods.Rd cd52df965f593fac06faa33ee52aa584 *man/readLisrel.Rd lisrelToR/man/0000755000175100001440000000000012101755246012765 5ustar hornikuserslisrelToR/man/readLisrel.Rd0000644000175100001440000000446112102723465015346 0ustar hornikusers\name{readLisrel} \alias{readLisrel} \title{ Read LISREL matrices into R } \description{ This function scans LISREL (Joreskog & Sorbom, 1996) output for model matrices and fit indices. } \usage{ readLisrel(x) } %- maybe also 'usage' for other objects documented here. \arguments{ \item{x}{ String indicating the location of a LISREL output file. } } \details{ \code{LisrelToR} uses the following names for the model matrices: \describe{ \item{LY}{ Lambda-Y matrix. } \item{PS}{ Psi matrix. } \item{BE}{ Beta matrix. } \item{TE}{ Theta-Epsilon matrix. } \item{TY}{ Tau-Y matrix. } \item{AL}{ Alpha matrix. } \item{LX}{ Lambda-X matrix. } \item{PH}{ Phi matrix. } \item{GA}{ Gamma matrix. } \item{TD}{ Theta-Delta matrix. } \item{TX}{ Tau-X matrix. } \item{KA}{ Kappa } \item{ObsCovs}{ The observed covariance matrix, or a list of such matrices for each group. } \item{ImpCovs}{ The implied covariance matrix, or a list of such matrices for each group. } } Furthermore, \code{lisrelToR} uses the following names for matrix types: \describe{ \item{est}{Parameter estimates} \item{se}{Standard errors} \item{t}{t-values} \item{parSpec}{Parameter numbers} } } \value{ A list of class \code{"lisrel"} contaning: \item{fitIndices}{Fit indices, currently not supported.} \item{matrices}{A list contaning the model matrices. For each group this list conains a list with for each matrix (using LISREL style naming, see details) a list contaning elements \code{est} for parameter estimates, \code{se} for standard errors, \code{t} for t-values and \code{parSpec} for parameter numbers. Use \code{\link{lisrelMatrix}} to extract the matrices.} \item{variables}{Currently not used.} \item{Covariances}{A list with elements \code{implied} and \code{observed} containing the implied and observed covariance matrices.} } \references{ Joreskog, K. G., & Sorbom, D. (1996). LISREL 8 user's reference guide. Scientific Software. } \author{ Sacha Epskamp } \examples{ ## Measurment invariance example: download.file("http://sachaepskamp.com/files/mi1.OUT",modFile <- tempfile(fileext=".OUT")) Lis <- readLisrel(modFile) # Extract Lambda-Y for group 2: lisrelMatrix(Lis,"LY", group = 2) # Structure of object: str(Lis) # Print full LISREL output to console: print(Lis) } \seealso{ \code{\link{lisrelMatrix}} }lisrelToR/man/methods.Rd0000644000175100001440000000125112102724050014704 0ustar hornikusers\name{lisrel-methods} \alias{print.lisrel} %\alias{plot.lisrel} %\alias{summary.lisrel} %- Also NEED an '\alias' for EACH other topic documented here. \title{ Methods for lisrel objects } \description{ Print method prints LISREL output file to the console, summary method returns RAM of parameter estimates as given by \code{semPlotModel} from the \code{semPlot} package and plot method calls \code{semPaths} from the \code{semPlot} package. } \usage{ \method{print}{lisrel}(x, \dots) } %- maybe also 'usage' for other objects documented here. \arguments{ \item{x}{ output of \code{\link{readLisrel}} } \item{\dots}{Not used} } \author{ Sacha Epskamp } lisrelToR/man/lisrelToR-package.Rd0000644000175100001440000000076012100526457016566 0ustar hornikusers\name{lisrelToR-package} \alias{lisrelToR-package} \alias{lisrelToR} \docType{package} \title{ Import LISREL output in R. } \description{ This is an unofficial package aimed at automating the import of LISREL output in R. This package or its maintainer is not in any way affiliated with the creators of LISREL and SSI, Inc. } \author{ Sacha Epskamp (mail@sachaepskamp.com) Maintainer: Sacha Epskamp } \references{ github.com/SachaEpskamp/lisrelToR } \keyword{ package }lisrelToR/man/lisrelMatrix.Rd0000644000175100001440000000373012100526141015723 0ustar hornikusers\name{lisrelMatrix} \alias{lisrelMatrix} %- Also NEED an '\alias' for EACH other topic documented here. \title{ Extract LISREL matrices from \code{lisrel} object. } \description{ This function can be used to extract matrices from the output of \code{\link{readLisrel}}. } \usage{ lisrelMatrix(object, matrix, group = 1, type = "est") } %- maybe also 'usage' for other objects documented here. \arguments{ \item{object}{ A \code{"lisrel"} object obtained by \code{\link{readLisrel}}. } \item{matrix}{ Specification of the matrix to be extracted. See details. } \item{group}{ An integer specifying which group the matrix should be extracted from. } \item{type}{ Specification of the type of matrix to be extracted. } } \details{ \code{LisrelToR} uses the following names for the model matrices: \describe{ \item{LY}{ Lambda-Y matrix. } \item{PS}{ Psi matrix. } \item{BE}{ Beta matrix. } \item{TE}{ Theta-Epsilon matrix. } \item{TY}{ Tau-Y matrix. } \item{AL}{ Alpha matrix. } \item{LX}{ Lambda-X matrix. } \item{PH}{ Phi matrix. } \item{GA}{ Gamma matrix. } \item{TD}{ Theta-Delta matrix. } \item{TX}{ Tau-X matrix. } \item{KA}{ Kappa } \item{ObsCovs}{ The observed covariance matrix, or a list of such matrices for each group. } \item{ImpCovs}{ The implied covariance matrix, or a list of such matrices for each group. } } Furthermore, \code{lisrelToR} uses the following names for matrix types: \describe{ \item{est}{Parameter estimates} \item{se}{Standard errors} \item{t}{t-values} \item{parSpec}{Parameter numbers} } } \value{ A matrix. } \references{ Joreskog, K. G., & Sorbom, D. (1996). LISREL 8 user's reference guide. Scientific Software. } \author{ Sacha Epskamp } \seealso{ \code{\link{readLisrel}} } \examples{ ## Measurment invariance example: download.file("http://sachaepskamp.com/files/mi1.OUT",modFile <- tempfile(fileext=".OUT")) Lis <- readLisrel(modFile) # Extract Lambda-Y for group 2: lisrelMatrix(Lis,"LY", group = 2) } lisrelToR/README.md0000644000175100001440000000031612061637515013474 0ustar hornikuserslisrelToR ========= This is an unofficial package aimed at automating the import of LISREL output in R. This package or its maintainer is not in any way affiliated with the creators of LISREL and SSI, Inc.lisrelToR/R/0000755000175100001440000000000012102721017012401 5ustar hornikuserslisrelToR/R/zzz.R0000644000175100001440000000053112100523164013361 0ustar hornikusers# I copied this piece of code from Lavaan mainly: .onAttach <- function(libname, pkgname) { version <- read.dcf(file=system.file("DESCRIPTION", package=pkgname), fields="Version") packageStartupMessage("This is ",paste(pkgname, version)) packageStartupMessage(pkgname, " is BETA software! Please report any bugs.") }lisrelToR/R/readLisrel.R0000644000175100001440000001101712115342062014615 0ustar hornikusersreadLisrel <- function(x) { # Read output: Out <- readLines(x) # Empty output structure (S3): Res <- list( fitIndices = list(), # list containing dataframes, 'global' and 'Group1'. 'Group2',... matrices = list( ), # List containing per matrix a list contaning 'est', 'par', 'se', 't' matrices variables = data.frame(), # data frame contaning information on each variable: manifest or latent and exo or endo. covariances = list( implied = NULL, # model Implied covariance matrix observed = NULL # observed covariance matrix ), output = Out ) class(Res) <- "lisrel" class(Res$matrices) <- c("list","semMatrixModel") ### Find linenumbers of output structure: Struc <- list( parSpec = grep("Parameter Specifications",Out), est = grep("LISREL Estimates",Out), fit = grep("Goodness of Fit Statistics",Out), modInd = grep("Modification Indices and Expected Change",Out), std = grep("Standardized Solution",Out), stdComp = grep("Completely Standardized Solution",Out), stdcommet = grep("Common Metric Standardized Solution",Out), stdcommetComp = grep("Common Metric Completely Standardized Solution",Out) ) Struc$std <- Struc$std[!Struc$std%in%c(Struc$stdComp,Struc$stdcommet,Struc$stdcommetComp)] Struc$stdComp <- Struc$stdComp[!Struc$stdComp%in%Struc$stdcommetComp] StrucUL <- unlist(Struc) ### Find linenumbers of matrices: Mats <- list( ObsCov = grep("^\\s*Covariance Matrix\\s*$",Out), ImpCov = grep("^\\s*Fitted Covariance Matrix\\s*$",Out), LX = grep("LAMBDA-X",Out), PH = grep("PHI",Out), TD = grep("THETA-DELTA",Out), GA = grep("GAMMA",Out), LY = grep("LAMBDA-Y",Out), PS = grep("PSI",Out), TE = grep("THETA-EPS",Out), BE = grep("BETA",Out), TX = grep("TAU-X",Out), TY = grep("TAU-Y",Out), AL = grep("ALPHA",Out), KA = grep("KAPPA",Out) ) Mats$ObsCov <- Mats$ObsCov[!Mats$ObsCov%in%Mats$ImpCov] # Check for continued matrices: for (i in 1:length(Mats)) { if (length(Mats[[i]])>0) { Inds <- lapply(Mats[[i]],matRange,Out=Out) Mats[[i]] <- Mats[[i]][!sapply(Mats[[i]],function(x)any(x>sapply(Inds,'[',1) & x<=sapply(Inds,'[',2)))] } } # Extract number of groups from parSpec matrices: Ng <- length(Struc$parSpec) ### EXTRACT MATRICES ### for (mat in c("LX","PH","TD","GA","TX","KA","LY","PS","TE","BE","TY","AL")) { Res$matrices[[mat]] <- list() for (g in Ng:1) { Res$matrices[[mat]][[g]] <- list() for (type in c("est","std","stdComp","stdcommet","stdcommetComp","parSpec")) { if (length(Struc[[type]])>0) { if (length(Struc[[type]])!=Ng) warning(paste("Number of",type,"matrices are not equal to number of parameter specification matrices. Resulting multigroup structure will NOT be reliable")) Res$matrices[[mat]][[g]][[type]] <- findMatrix(mat,type,Mats,Struc,Out,g) if (identical(Res$matrices[[mat]][[g]][[type]],"NextGroup")) { Res$matrices[[mat]][[g]][[type]] <- Res$matrices[[mat]][[g+1]][[type]] if (type=="est") { Res$matrices[[mat]][[g]][['se']] <- Res$matrices[[mat]][[g+1]][['se']] Res$matrices[[mat]][[g]][['t']] <- Res$matrices[[mat]][[g+1]][['t']] } } else if (type=="est" & is.list(Res$matrices[[mat]][[g]][[type]])) { Res$matrices[[mat]][[g]][['se']] <- Res$matrices[[mat]][[g]][[type]][['se']] Res$matrices[[mat]][[g]][['t']] <- Res$matrices[[mat]][[g]][[type]][['t']] Res$matrices[[mat]][[g]][[type]] <- Res$matrices[[mat]][[g]][[type]][['est']] } } } } names(Res$matrices[[mat]]) <- paste("group",seq_along(Res$matrices[[mat]]),sep="") } Res$covariances$implied <- findCov("ImpCov",Mats,Out) if (length(Res$covariances$implied)>0) names(Res$covariances$implied) <- paste("group",seq_along(Res$covariances$implied),sep="") Res$covariances$observed <- findCov("ObsCov",Mats,Out) if (length(Res$covariances$observed)>0) names(Res$covariances$observed) <- paste("group",seq_along(Res$covariances$observed),sep="") # # if (length(Struc$fit)==1) # { # Res$fitIndices$global <- findFit(Out,Struc$fit) # } else { # Res$fitIndices$global <- findFit(Out,Struc$fit[grep("Global",Out[Struc$fit])]) # for (g in 1:(length(Struc$fit)-1)) # { # Res$fitIndices[[paste("group",g,sep="")]] <- findFit(Out,Struc$fit[grep("Group",Out[Struc$fit])[g]]) # } # } # # Return: return(Res) } lisrelToR/R/methods.R0000644000175100001440000000074712102723344014204 0ustar hornikusers print.lisrel <- function(x, ...) { cat("\n",paste(x$output,collapse="\n"),"\n") } # # # Plot function from semPlot: # plot.lisrel <- function(x, ...) # { # if (!require("semPlot")) stop("Plot method requires 'semPlot' package to be installed") # semPaths(x, ...) # } # # # Summary function returns RAM: # summary.lisrel <- function(object, ...) # { # if (!require("semPlot")) stop("Summary method requires 'semPlot' package to be installed") # semPlotModel(object)@RAM # }lisrelToR/R/matRange.R0000644000175100001440000000073012061637515014277 0ustar hornikusersmatRange <- function(start,lisName,Out) { if (grepl("IN THE FOLLOWING GROUP",Out[start])) return(c(start,start)) if (missing(lisName)) lisName <- gsub("(^\\s*)|(\\s*$)","",Out[start]) # Find end: IndEnd <- start repeat { IndEnd <- IndEnd + 1 if (length(Out)==IndEnd) break if (Out[IndEnd]=="" & !grepl(lisName,Out[IndEnd+1]) & !grepl(lisName,Out[IndEnd-1]) & !grepl(" Note:",Out[IndEnd-1],ignore.case=TRUE)) break } return(c(start,IndEnd)) }lisrelToR/R/lisrelMatrix.R0000644000175100001440000000525412061637515015226 0ustar hornikuserslisrelMatrix <- function(object, matrix, group = 1, type = "est") { # Check class: if (!"lisrel"%in%class(object)) stop("Input must be a 'lisrel' object.") # Set defaults: if (missing(matrix)) { matrix <- names(object$matrices)[sapply(lapply(object$matrices,sapply,length),function(x)all(x>0))] } else { # Set matrix: matrix[grepl("lamb?d?a?.?x",matrix,ignore.case=TRUE)] <- "LX" matrix[grepl("lamb?d?a?.?y",matrix,ignore.case=TRUE)] <- "LY" matrix[grepl("phi",matrix,ignore.case=TRUE)] <- "PH" matrix[grepl("the?t?a?.?(y|eps)",matrix,ignore.case=TRUE)] <- "TE" matrix[grepl("the?t?a?.?(x|del)",matrix,ignore.case=TRUE)] <- "TD" matrix[grepl("gamm?a?",matrix,ignore.case=TRUE)] <- "GA" matrix[grepl("psi",matrix,ignore.case=TRUE)] <- "PS" matrix[grepl("bet?a?",matrix,ignore.case=TRUE)] <- "BE" matrix[grepl("tau.?x",matrix,ignore.case=TRUE)] <- "TX" matrix[grepl("tau.?y",matrix,ignore.case=TRUE)] <- "TY" matrix[grepl("alp?h?a?",matrix,ignore.case=TRUE)] <- "AL" matrix[grepl("kap?p?a?",matrix,ignore.case=TRUE)] <- "KA" if (any(grepl("lam?",matrix,ignore.case=TRUE))) { if (length(object$matrices$LX[[1]]) == 0 & length(object$matrices$LY[[1]]) > 0) { matrix[grepl("lam?",matrix,ignore.case=TRUE)] <- "LY" } else if (length(object$matrices$LX[[1]]) > 0 & length(object$matrices$LY[[1]])==0) { matrix[grepl("lam?",matrix,ignore.case=TRUE)] <- "LX" } else stop(paste("Matrix",grep("lam?",matrix,value=TRUE,ignore.case=TRUE),"could not be interpreted.")) } if (any(grepl("tau",matrix,ignore.case=TRUE))) { if (length(object$matrices$TX[[1]]) == 0 & length(object$matrices$TY[[1]]) > 0) { matrix[grepl("tau",matrix,ignore.case=TRUE)] <- "TY" } else if (length(object$matrices$TX[[1]]) > 0 & length(object$matrices$TY[[1]])==0) { matrix[grepl("tau",matrix,ignore.case=TRUE)] <- "TX" } else stop(paste("Matrix",grep("tau",matrix,value=TRUE,ignore.case=TRUE),"could not be interpreted.")) } if (any(grepl("thet?a?",matrix,ignore.case=TRUE))) { if (length(object$matrices$TD[[1]]) == 0 & length(object$matrices$TE[[1]]) > 0) { matrix[grepl("thet?a?",matrix,ignore.case=TRUE)] <- "TE" } else if (length(object$matrices$TD[[1]]) > 0 & length(object$matrices$TE[[1]])==0) { matrix[grepl("thet?a?",matrix,ignore.case=TRUE)] <- "TD" } else stop(paste("Matrix",grep("thet?a?",matrix,value=TRUE,ignore.case=TRUE),"could not be interpreted.")) } } Res <- lapply(object$matrices[matrix],function(x)x[[group]][[type]]) if (length(Res)==1) Res <- Res[[1]] return(Res) }lisrelToR/R/getMatrix.R0000644000175100001440000001220712140753705014505 0ustar hornikusersgetMatrix <- function(x,name,diag=FALSE,symmetrical=FALSE,estimates) { ### Fix default naming: x <- gsub("VAR (?=\\d)","VAR",x,perl=TRUE) x <- gsub("ETA (?=\\d)","ETA",x,perl=TRUE) x <- gsub("KSI (?=\\d)","KSI",x,perl=TRUE) xorig <- x # Make similar to readLines if length==1: if (length(x)==1) x <- strsplit(x,split="\n")[[1]] # Check if estimate matrix: if (missing(estimates)) { estimates <- any(grepl("\\(",x)) } if (estimates) { # First append spaces to every line: maxSpace <- max(nchar(x)) for (i in seq_along(x)) { x[i] <- paste(x[i],paste(rep(" ",maxSpace - nchar(x[i])), collapse=""), sep = "") } # Loop over lines, check if one contains "- -" and the next a bracket, and fill in "- -" signs for (i in which(grepl("- -",x[-length(x)]) & grepl("\\(",x[-1]))) { emLocs <- gregexpr("- -",x[i])[[1]] for (j in 1:length(emLocs)) { substring(x[i+1],emLocs[j],emLocs[j]+2) <- "- -" substring(x[i+2],emLocs[j],emLocs[j]+2) <- "- -" } } } # Remove leading and trailing spaces: x <- gsub("^\\s+","",x) x <- gsub("\\s+$","",x) # Remove empty lines: x <- x[x!=""] # Normalize spacing: # x <- gsub("\\s+"," ",x) # Make "- -" NA: x <- gsub("- -","NA",x) # Identify start of submatrices: sub <- grep(name,x) # Extract submatrices: X <- list() for (i in seq_along(sub)) { if (i1) { if (missing(symmetrical)) symmetrical <- TRUE totR <- nrow(Tabs[[1]]) for (i in 2:length(Tabs)) { Tabs[[i]] <- rbind(matrix(NA,totR-nrow(Tabs[[i]]),ncol(Tabs[[i]])),Tabs[[i]]) if (estimates) { seTabs[[i]] <- rbind(matrix(NA,totR-nrow(seTabs[[i]]),ncol(seTabs[[i]])),seTabs[[i]]) tTabs[[i]] <- rbind(matrix(NA,totR-nrow(tTabs[[i]]),ncol(tTabs[[i]])),tTabs[[i]]) # Xse[[i]] <- c(rep(paste(rep(NA,ncol(Tabs[[i]])),collapse=" "),totR-length(Xse[[i]])),Xse[[i]]) # Xt[[i]] <- c(rep(paste(rep(NA,ncol(Tabs[[i]])),collapse=" "),totR-length(Xt[[i]])),Xt[[i]]) } } } # Combine: Tab <- as.matrix(do.call(cbind,Tabs)) rownames(Tab) <- rowNames if (!any(dim(Tab)==1)) diag <- FALSE # Diagonalize: if (diag) { nm <- colnames(Tab) Tab <- diag(c(Tab),length(Tab),length(Tab)) rownames(Tab) <- colnames(Tab) <- nm } # Symmetrize: if (symmetrical) { Tab[upper.tri(Tab)] <- t(Tab)[upper.tri(Tab)] } Tab[is.na(Tab)] <- 0 # Compute SE and t-value matrices if needed: if (estimates) { # seTabs <- lapply(Xse,function(txt)as.matrix(read.table(text=txt,header=TRUE,fill=TRUE))) seTab <- do.call(cbind,seTabs) # tTabs <- lapply(Xt,function(txt)as.matrix(read.table(text=txt,header=TRUE,fill=TRUE))) tTab <- do.call(cbind,tTabs) # Diagonalize: if (diag) { seTab <- diag(c(seTab),length(seTab),length(seTab)) tTab <- diag(c(tTab),length(tTab),length(tTab)) } colnames(seTab) <- colnames(tTab) <- colnames(Tab) rownames(seTab) <- rownames(tTab) <- rownames(Tab) # Symmetrize: if (symmetrical) { seTab[upper.tri(seTab)] <- t(seTab)[upper.tri(seTab)] tTab[upper.tri(tTab)] <- t(tTab)[upper.tri(tTab)] } # Return list: return(list(est=Tab,se=seTab,t=tTab)) } # Return matrix: return(Tab) } lisrelToR/R/findMatrix.R0000644000175100001440000000222212061637515014644 0ustar hornikusersfindMatrix <- function(mat,type,Mats,Struc,Out,g) { StrucUL <- unlist(Struc) # Define LISREL name: if (mat=="LX") lisName <- "LAMBDA-X" if (mat=="PH") lisName <- "PHI" if (mat=="TD") lisName <- "THETA-DELTA" if (mat=="GA") lisName <- "GAMMA" if (mat=="LY") lisName <- "LAMBDA-Y" if (mat=="PS") lisName <- "PSI" if (mat=="TE") lisName <- "THETA-EPS" if (mat=="BE") lisName <- "BETA" if (mat=="TX") lisName <- "TAU-X" if (mat=="TY") lisName <- "TAU-Y" if (mat=="AL") lisName <- "ALPHA" if (mat=="KA") lisName <- "KAPPA" Res <- NULL if (length(Struc[[type]]) > 0 & length(Mats[[mat]]) > 0 & any(Mats[[mat]]>Struc[[type]][g])) { IndStart <- min(Mats[[mat]][Mats[[mat]]>Struc[[type]][g]]) if (!any(StrucUL[StrucUL > Struc[[type]][g]] < IndStart)) { # Checn equal next group" if (grepl(paste(lisName,"EQUALS",lisName,"IN THE FOLLOWING GROUP"),Out[IndStart])) { Res <- "NextGroup" } else { Inds <- matRange(IndStart,lisName,Out) Res <- getMatrix(Out[Inds[1]:Inds[2]],lisName,mat %in% c("TD","TE","PS","PH"),mat %in% c("TD","TE","PS","PH")) } } } return(Res) } lisrelToR/R/findFit.R0000644000175100001440000000115412061637515014125 0ustar hornikusersfindFit <- function(Out,start) { ### Extract fit statistics: IndStart <- start # Find end: IndEnd <- IndStart repeat { IndEnd <- IndEnd + 1 if (!(grepl("\\s*",Out[IndEnd]) | grepl("=",Out[IndEnd]))) break } modTxt <- Out[IndStart:IndEnd] modTxt <- modTxt[grepl("=",modTxt)] modTxt <- strsplit(modTxt,split="=") modTxt <- lapply(modTxt,gsub,pattern="^\\s*",replacement="") modTxt <- lapply(modTxt,gsub,pattern="\\s*$",replacement="") motTxt <- lapply(modTxt,function(x)c(x[1],paste(x[-1],collapse="="))) return(data.frame(Statstic=sapply(modTxt,"[",1),Value=sapply(modTxt,"[",2))) }lisrelToR/R/findCov.R0000644000175100001440000000065112061637515014133 0ustar hornikusersfindCov <- function(mat,Mats,Out) { # Define LISREL name: if (mat=="ObsCov") lisName <- "Covariance Matrix" if (mat=="ImpCov") lisName <- "Fitted Covariance Matrix" Res <- list() if (length(Mats[[mat]]) > 0) { for (g in seq_along(Mats[[mat]])) { Inds <- matRange(Mats[[mat]][[g]],lisName,Out) Res[[g]] <- getMatrix(Out[Inds[1]:Inds[2]],lisName,TRUE,TRUE) } } return(Res) }lisrelToR/NEWS0000644000175100001440000000116312140754022012704 0ustar hornikusersChanges in Version 0.1.4 o Fixed a bug with default names (ETA 1, VAR 3, etcetera) causing unexpected results. Changes in Version 0.1.3 o semPlot suggest removed to avoid the cyclic dependency behavior. o summary and plot method removed. Will be added in 'semPlot' in a future update. o Common metric standardization is now supported, although not yet documented. o Several bug fixes for large LISREL model with large lower triangle parameter estimate matrices. Changes in version 0.1.1 o 'paste0' calls have been replaced by 'paste' for backward compatibility. o Added plot and summary methods using 'semPlot'lisrelToR/NAMESPACE0000644000175100001440000000016412102723330013420 0ustar hornikusersexport(readLisrel) export(lisrelMatrix) S3method(print, lisrel) # S3method(plot, lisrel) # S3method(summary, lisrel)lisrelToR/DESCRIPTION0000644000175100001440000000105412142463423013716 0ustar hornikusersPackage: lisrelToR Type: Package Title: Import output from LISREL into R Version: 0.1.4 Date: 2013-05-08 Depends: R (>= 2.15.0) Author: Sacha Epskamp Maintainer: Sacha Epskamp Description: This is an unofficial package aimed at automating the import of LISREL output in R. This package or its maintainer is not in any way affiliated with the creators of LISREL and SSI, Inc. License: GPL-2 Packaged: 2013-05-08 13:34:56 UTC; sacha NeedsCompilation: no Repository: CRAN Date/Publication: 2013-05-08 16:54:11