Skip to Content
Modern R Programming Cookbook
book

Modern R Programming Cookbook

by Jaynal Abedin
October 2017
Beginner to intermediate
236 pages
7h 38m
English
Packt Publishing
Content preview from Modern R Programming Cookbook

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 the text from an URL, first, you need to create a connection between your R session and the web page.
  2. Note that your computer must be connected to the internet to run this recipe. Once you have connected and created the connection of R session, you are ready to retrieve the HTML code form of the page. Here is the code to do the whole thing:
        sourceURL <-         "https://en.wikipedia.org/wiki/Programming_with_Big_Data_in_R"        link2web <- url(sourceURL)        htmlText <- readLines(link2web)        close(link2web)
  1. Now you have the HTML text in an object called htmlText. This object contains plain text as well as HTML tag pairs. The task ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

R Cookbook, 2nd Edition

R Cookbook, 2nd Edition

JD Long, Paul Teetor

Publisher Resources

ISBN: 9781787129054Supplemental Content