Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Without the regexpr() and gregexpr() functions, write a function called my_gregexpr() that inputs a character string pattern and a character vector text and returns a

Without the regexpr() and gregexpr() functions, write a function called my_gregexpr() that inputs a character string pattern and a character vector text and returns a list of the same length as text, each component of which is an integer vector giving the starting positions of every (disjoint) match of pattern in the corresponding entry in text or -1 if there is no match. The output values from my_gregexpr(pattern, text) and gregexpr(pattern, text) should be identical for any character string pattern and character vector text. Hint: Your my_gregexpr() function only needs to account for literal patterns, i.e., it does not need to work for regular expressions. Note: You do not need to add attributes to each component of the output list of my_gregexpr() to match gregexpr(). This will mean identical(my_gregexpr(pattern, text), gregexpr(pattern, text)) will always return FALSE

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Engineering Mathematics

Authors: Erwin Kreyszig

10th edition

470458364, 470458365, 978-0470458365

More Books

Students also viewed these Mathematics questions

Question

Write each fraction as a percent. 7 50

Answered: 1 week ago