Skip to content
Prev 170095 / 398506 Next

Question about apply()

Sergey Goriatchev wrote:
Ah, yes, sorry. The real issue is that you are trying to index twice,
both by apply(.,2,.)  and by z="TY1.lev" (the former loops over columns
and the latter selects one of them). So what func() sees is an
individual column, and you just can't index that any further, and in
particular not with "TY1.lev". Possibly, using just embed(x,2) will get
you somewhere, but as you've seen, there are simpler ways-