Hello
Consider following dataframe named df

var1    var2    var3
3771    354     565
654654  963     6677
775     147     657754

df <- read.table('clipboard', header = TRUE)
df
#find indexes with '77' in var 1
myIndexes <- grep( glob2rx("*77*"), df$var1)
myIndexes
#find actual values of seach above
myValu <- grep( glob2rx("*77*"), df$var1, value=TRUE)
myValu
#find all '77' in entire dataframe
all77 <- lapply(df, function(x)grep( glob2rx("*77*"), x, value=TRUE))
all77
#OR indexes
all77ind <-lapply(df, function(x)grep( glob2rx("*77*"), x))
all77ind


Hope that helps
With best regards
Denis

______________________________________________
R-help@r-project.org mailing list
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