DeclareDesign/fabricatr

message when passing data with a variable called N

Closed this issue · 3 comments

> data = data.frame(N = 1:3)
> fabricate(data, M = 2)
Error: `data` must be uniquely named but has duplicate elements

diagnosands dataframes might often have a variable called "N" in them since that it a dimension along which expand_design likely operates; special use of N in fabricatr means it cannot be used in these. That's a cost.

  • Useful to have a warning of the form : "fabricatr cannot accept dataframes with variables named N"
  • Better, perhaps: temporarily rename N, implement operations, then restore name
  • Better, perhaps, though possibly too late: use a more obscure name for fabricator's N.

Like solution 2 a lot if not too hard, solution 1 seems like a very good idea in the meantime. Not keen on 3 because I love the special N syntax (willing to bear cost).