Error: could not find function ":="

8,597 views
Skip to first unread message

z.toh...@gmail.com

unread,
Nov 15, 2014, 1:37:39 PM11/15/14
to lav...@googlegroups.com
Hi, 

I'm trying to run a moderated mediation using lavaan, but when it comes to my indirect effects I keep getting the following error: 
Error: could not find function ":="

I have installed lavaan so why do I get the above error?

Thank you. 

Zahra

 

Edward Rigdon

unread,
Nov 15, 2014, 2:33:06 PM11/15/14
to lav...@googlegroups.com

Zahra—

     Since := is an operator within your lavaan model syntax, R must think the operator is sitting outside your syntax.  Could you share your R transcript?  My first guess is that you have a misplaced tic mark (‘), leading R to exclude the line containing := from your syntax string.  That, or some other typo.

     Remember, you must have lavaan installed AND have the package loaded.  But if that were the issue, R would be complaining about the lavaan or sem or cfa function, not about characters within your syntax string.

--Ed Rigdon

--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at http://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.

z.toh...@gmail.com

unread,
Nov 15, 2014, 4:06:30 PM11/15/14
to lav...@googlegroups.com
Hi Ed,

Thanks so much. 

You were absolutely right, I'd forgot to end my lavaan syntax with the tic mark(') and that was it! After I added the (') everything ran smoothly. 

Cheers, 

Zahra

Vipin Raj C

unread,
Oct 29, 2017, 2:46:39 AM10/29/17
to lavaan
products[is.na(promotion_description), promotion_description := "no_promo"]
Error in `:=`(promotion_description, "no_promo") : 
  could not find function ":="
I am getting this error what should i do?

Terrence Jorgensen

unread,
Oct 30, 2017, 11:39:17 PM10/30/17
to lavaan
products[is.na(promotion_description), promotion_description := "no_promo"]
Error in `:=`(promotion_description, "no_promo") : 
  could not find function ":="
I am getting this error what should i do?

":=" is not an R function. It is only an operator in the lavaan model syntax

?lavaanify

It looks like you are trying to use it to select certain columns of a data.frame or matrix object called products, although I'm not sure your syntax makes sense because I don't know what your "promotion_description" object is.  You probably want a logical operator, but I can't tell whether you want to test equality or inequality:

?Comparison

Without more context, I doubt I could tell you what is going wrong, but this does not seem like a lavaan issue since your syntax and error have nothing to do with lavaan.  General R questions can be posted on Cross Validated


You should try to provide a minimally reproducible example before posting there, so people can actually see what is going wrong instead of guessing.

Terrence D. Jorgensen
Postdoctoral Researcher, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam


Elke Vrijens

unread,
Aug 4, 2018, 2:49:35 AM8/4/18
to lavaan
Best,

I got the same error ''could not find function ":=" ''. I've been looking for thinks I could have done wrong, but I can not find them. Do you have some propositions on what I can do, to make this function work?

Regards,

Elke

Op dinsdag 31 oktober 2017 04:39:17 UTC+1 schreef Terrence Jorgensen:

Christopher Desjardins

unread,
Aug 4, 2018, 9:37:46 AM8/4/18
to lav...@googlegroups.com
:= is a function in data.table. Make sure you have data.table loaded. 
--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages