In addition to @Marek’s comment about not including fixed==TRUE
, you also need to not have the spaces in your regular expression. It should be "A1|A9|A6"
.
You also mention that there are lots of patterns. Assuming that they are in a vector
toMatch <- c("A1", "A9", "A6")
Then you can create your regular expression directly using paste
and collapse = "|"
.
matches <- unique (grep(paste(toMatch,collapse="|"), myfile$Letter, value=TRUE))
Related Posts:
- R Hex to RGB converter
- How do I select the first row in an R data frame that meets certain criteria?
- How is the AND/OR operator represented as in Regular Expressions?
- OR condition in Regex
- Using or ‘|’ in regex [duplicate]
- Poker hand range chart visualization in R
- Poker hand range chart visualization in R
- Emulate ggplot2 default color palette
- ggplot wrong color assignment
- How to rename a single column in a data.frame?
- Critical t values in R
- Error in plot.new() : figure margins too large, Scatter plot
- Error in file(file, “rt”) : cannot open the connection [duplicate]
- Error in
: object of type ‘closure’ is not subsettable - What does %>% function mean in R?
- What is a Context Free Grammar?
- t-stat for feature selection
- python .replace() regex [duplicate]
- Could not find function “%<>%” with dplyr loaded
- How to join (merge) data frames (inner, outer, left, right)
- Interpreting “condition has length > 1” warning from `if` function
- rbind error: “names do not match previous names”
- rbind error: “names do not match previous names”
- How to coerce a list object to type ‘double’
- Reasons for using the set.seed function
- R Error in x$ed : $ operator is invalid for atomic vectors
- Regex not operator
- $ operator is invalid for atomic vectors for dataframe R
- Plotting with ggplot2: “Error: Discrete value supplied to continuous scale” on categorical y-axis
- ggplot2 error : Discrete value supplied to continuous scale
- What does \’.- mean in a Regular Expression
- Regex not operator
- What do ++ and *+ mean?
- ggplot2 line chart gives “geom_path: Each group consist of only one observation. Do you need to adjust the group aesthetic?”
- ggplot2 line chart gives “geom_path: Each group consist of only one observation. Do you need to adjust the group aesthetic?”
- How to open CSV file in R when R says “no such file or directory”?
- Error: could not find function “%>%”
- How can I exclude one word with grep?
- Javascript split regex question
- R on MacOS Error: vector memory exhausted (limit reached?)
- How can I validate an email address using a regular expression?
- Regular expression to match a line that doesn’t contain a word
- Matching a space in regex
- Regex not operator
- R programming: How do I get Euler’s number?
- What does na.rm=TRUE actually means?
- Remove legend ggplot 2.2
- Error in if/while (condition) {: missing Value where TRUE/FALSE needed
- adding x and y axis labels in ggplot2
- How to accept space in regex?
- How do I replace NA values with zeros in an R dataframe?
- How to change legend title in ggplot
- Difference between \b and \B in regex
- Changing column names of a data frame
- How to match “any character” in regular expression?
- Set NA to 0 in R
- R: Using equation with natural logarithm in nls
- How to change legend title in ggplot
- Error in do_one(nmeth) : NA/NaN/Inf in foreign function call (arg 1)
- regex match any whitespace
- Regex: ignore case sensitivity
- What does the regex \S mean in JavaScript?
- R on MacOS Error: vector memory exhausted (limit reached?)
- whitespace in regular expression
- How can I validate an email address using a regular expression?
- Counting the number of elements with the values of x in a vector
- Non-numeric Argument to Binary Operator Error in R
- How do I use a regex in a shell script?
- kmeans complains “NA/NaN/Inf in foreign function call (arg 1)”, when there are none?
- Regex: ignore case sensitivity
- Why use as.factor() instead of just factor()
- Update R using RStudio
- mean() warning: argument is not numeric or logical: returning NA
- ‘x’ and ‘y’ lengths differ ERROR when plotting
- What are the “standard unambiguous date” formats for string-to-date conversion in R?
- Python regex AttributeError: ‘NoneType’ object has no attribute ‘group’
- What does “Error: object ‘
‘ not found” mean? - Regular Expression for alphanumeric and underscores
- What is the difference between the regular expressions [^\d\s] and [\D\S]
- Non-numeric Argument to Binary Operator Error in R
- mean() warning: argument is not numeric or logical: returning NA
- ‘x’ and ‘y’ lengths differ ERROR when plotting
- What are the “standard unambiguous date” formats for string-to-date conversion in R?
- Regex: AttributeError: ‘NoneType’ object has no attribute ‘groups’
- R issue “object not found”
- Regular Expression for alphanumeric and underscores
- re.sub erroring with “Expected string or bytes-like object”
- grep –ignore-case –only
- Difference between paste() and paste0()
- Error in Confusion Matrix : the data and reference factors must have the same number of levels
- How do I delete rows in a data frame?
- Regex AND operator
- Why do I get “number of items to replace is not a multiple of replacement length”
- Error in grid.Call(L_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : Polygon edge not found
- python re.split() to split by spaces, commas, and periods, but not in cases like 1,000 or 1.50
- python re.split() to split by spaces, commas, and periods, but not in cases like 1,000 or 1.50
- Remove duplicated rows
- Regex to test if string begins with http:// or https://
- Regular expression negative lookahead
- Drop data frame columns by name