search for: predvarnames

Displaying 1 result from an estimated 1 matches for "predvarnames".

2005 Jan 11
2
getting variable names from formula
...this to get the names (in character form) of the variables on the RHS of '~' ? dat <- data.frame(x1 = x1 <- rnorm(100,0,1), x2 = x2 <- rnorm(100,0,1), y = x1 + x2 + rnorm(100,0,1)) f <- y ~ x1 + x2 mf <- model.frame(f, data=dat) mt <- attr(mf, "terms") predvarnames <- attr(mt, "term.labels") > predvarnames [1] "x1" "x2" ----- 2. Also, is there an easy/fast way to do it, without having the data set (dat) available? That is, not using 'model.frame' which requires 'data'? I understand that one approach for...