r - xtab error undefined columns selected -



r - xtab error undefined columns selected -

x = data.frame(a=c(t,f)) x['foo'] = c(t,f) lm(foo ~ ., info = x) # works lm(. ~ foo, info = x) # fails xtab(. ~ foo, info = x) # fails

the lastly line 1 want throws "undefined columns selected" error. need set dimension of x how i'm doing because name of dimension comes variable.

i've been messing while , can't figure out. doing wrong?

if you're referring xtabs base of operations r, turn formula around . on right of ~

> xtabs(foo ~ ., info = x) # # false true # 0 1 > xtabs(a ~ ., info = x) # foo # false true # 0 1

and same goes lm

r

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -