Suppose I have the following list:

test <- list(a=3,b=5,c=11)

I'm trying to figure out how to extract the characters to the left of the equal sign (i.e., I want to extract a list of the variable names, a, b and c.

I've tried the permutations I know of involving sub - things like sub("\\=.*", "", test), but no matter what I try, sub keeps returning (3, 5, 11). In other words, even though I'm trying to extract the 'stuff' before the = sign, I seem to be successful only at grabbing the stuff after the equal sign.

Pointers to the obvious fix? Thanks...

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to