R/findFit.R

Defines functions findFit

findFit <- 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)))
}

Try the lisrelToR package in your browser

Any scripts or data that you put into this service are public.

lisrelToR documentation built on May 9, 2022, 5:08 p.m.