Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Modern R Programming Cookbook

You're reading from   Modern R Programming Cookbook Recipes to simplify your statistical applications

Arrow left icon
Product type Paperback
Published in Oct 2017
Publisher Packt
ISBN-13 9781787129054
Length 236 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Jaynal Abedin Jaynal Abedin
Author Profile Icon Jaynal Abedin
Jaynal Abedin
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
1. Installing and Configuring R and its Libraries FREE CHAPTER 2. Data Structures in R 3. Writing Customized Functions 4. Conditional and Iterative Operations 5. R Objects and Classes 6. Querying, Filtering, and Summarizing 7. R for Text Processing 8. R and Databases 9. Parallel Processing in R

Using regular expression in text processing


A regular expression is simply a sequence of character strings that defines the search pattern. In natural language, processing and text mining are the two areas where regular expressions are used a lot. There are other application areas as well. In this recipe, you will perform text data pre-processing without using the tm library but by using a regular expression.

Getting ready

Suppose you have a corpus of documents and your objective is to find the frequent words in the corpus. So, the first thing is to do the pre-processing and then create term a document matrix. In this recipe, you will use a regular expression on the text data retrieved from a web page using the readLines() function. Specifically, you will read the following web page using the readLines() function:

https://en.wikipedia.org/wiki/Programming_with_Big_Data_in_R

How to do it…

Let's take a look at the following steps to learn how to use a regular expression in text processing:

  1. To read...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Banner background image