Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

13. Cleaning Data: Impose order > R can use regular expressions to crunch compl...

R can use regular expressions to crunch complex data patterns

Regular expressions are a programming tool that allows you to specify complex patterns to match and replace strings of text, and R has a powerful facility for using them.

Here’s a simple regular expression pattern that looks for the letter “a”. When you give this pattern to R, it’ll say whether there’s a match.

Geek Bits

To learn more about the full regex specification and syntax, type ?regex in R.

image with no caption
image with no caption

Regular expressions are the ultimate tool for cleaning up messy data. Lots of platforms and languages implement regular expressions, even though Excel doesn’t.

From: Head First Head Hunters

To: Analyst

Subject: Need those names NOW

Well get on with it! Those prospects are hot and are only getting colder. I want our sales force to start calling people like yesterday!


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint