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 it works…

This is the simplest approach to reading text data from a web page. The steps are very simple and intuitive to understand. The url() function creates a connection link between the web page and R session, and then it reads the text line by line through the readLines() function. Since the code reads the HTML source code line by line, the resultant object is a vector of character. Each line contains the HTML source code from the original HTML web page.

Though the output object contains HTML code, you are not able to do further processing assuming an HTML structure. The output object is a completely unstructured text vector. Here is the output of the first few lines:

From the preceding output, it is clear that to do any further ...

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