On Thu, 25 May 2023 13:29:52 -0400 Evan Cooch <evan.co...@gmail.com> wrote:
> 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... Perhaps names(test) ??? cheers, Rolf Turner -- Honorary Research Fellow Department of Statistics University of Auckland Stats. Dep't. (secretaries) phone: +64-9-373-7599 ext. 89622 Home phone: +64-9-480-4619 ______________________________________________ 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.