0

First of all sorry if the question is repeated, I did not find an answer to this question. I want to get a logical vector indicating it each word of v's vector contains ".x" in its name, where the dot is a part of the evaluated text. When I run this code:

# Vector with names
  v <- c("extra", "file.x", "file.y")
# Does v's words contain ".x" text?
 grepl(".x", v)

I get TRUE TRUE FALSE, so I think in ".x" the dot means that there is anything before the x and what I want is the dot as an string. How can I deal with taht?

This is motivated because after using merge function repeated columns appear with that extension.

R18
  • 1,476
  • 1
  • 8
  • 17

0 Answers0