[R] extract parts of a list before symbol
|kw@|mmo @end|ng |rom gm@||@com
Fri May 26 02:20:56 CEST 2023
You probably want `names(test)`.
On Thu, May 25, 2023 at 7:58 PM Evan Cooch <evan.cooch using 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...
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
More information about the R-help