0

enter image description here** above image showing sample data list, so i want to get only record that content specific keyword end like (contact); on that row. **

data <- read.csv("csv.csv", sep = ',')

# Get the max salary from data frame.
Piname <- data$col_NAME
print(Piname)
poname <- Piname[str_detect(Piname,"(end_string);")]
print(poname)

#summary(warnings())

tail(warnings(), 50)
Mr Coder
  • 507
  • 3
  • 13

1 Answers1

1

We can either escape the () \\(contact\\);$ and use it as pattern

Piname[str_detect(Piname, "\\(contact\\);$")]

as by default, the ( or ) would be recognized as metacharacters to capture the characters as a group. The $ is a metacharacter to signify the end of string

akrun
  • 874,273
  • 37
  • 540
  • 662