Skip to content

Variable Wildcard Value

1 message · Dieter Menne

#
Francis Smart <fsmart <at> gmail.com> writes:
If grep on a vector does not help, maybe the following comes closer?
Finding all variables 

rm(list=ls(all=TRUE))
a = 33
aa = 44
dd = 33
c = 3

names = "^a.*"
Vars <- ls()
r <- Vars[grep(names,Vars)]
r # not really correct for names.* and Vars.*

Dieter