I can't tell fore sure if this is the only cause, since you are not providing a REPRoducible EXample (reprex), but you are supposed to pass a dataframe as data argument, not a character string (i.e. dat instead of "dat").
1 Like