R/f_convenience_simplestructure.R

Defines functions simplestructure

Documented in simplestructure

simplestructure <- function(x){
  factors <- sort(unique(x))
  nVar <- length(x)
  nFact <- length(factors)
  lambda <- matrix(0,nVar,nFact)

  for (i in seq_along(x)){
    lambda[i,x[i]==factors] <- 1
  }
  colnames(lambda) <- factors
  return(lambda)
}

Try the psychonetrics package in your browser

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

psychonetrics documentation built on Oct. 3, 2023, 5:09 p.m.