[R] cbind formula definition

"Biedermann, Jürgen" juergen.biedermann at charite.de
Tue Sep 8 16:13:21 CEST 2009


Hi there,

I have the following problem:

I have a package called "polLCA" which has the following syntax:

poLCA(formula, data)

and needs the following formula definition:

formula <- cbind(V1,V2,V3,...)

So far so good.

What I tried now was the following:
#Get "data" with the "read.table" fuction
data <- read.table("d:/ .....)
#Select cols to use in the analysis
aktDat <- data[2:15]
#get the names
names(aktDat)
#put them together in one string, comma as separation sign
bi <- paste(names(aktDat),collapse=",")
#use this string in the "f" function to bind the variables
formula <- cbind(bi)~1
#Calculate the modell
poLCA(formula, data)

but this doesn't work: I get the following error message:

"Warnung in model.matrix.default(formula, mframe) :
  variable 'cbind(bi)' converted to a factor"

Could anyone help me?
Thanks

Greetings
Jürgen




More information about the R-help mailing list