Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning R Programming

You're reading from  Learning R Programming

Product type Book
Published in Oct 2016
Publisher Packt
ISBN-13 9781785889776
Pages 582 pages
Edition 1st Edition
Languages
Author (1):
Kun Ren Kun Ren
Profile icon Kun Ren

Table of Contents (21) Chapters

Learning R Programming
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
1. Quick Start 2. Basic Objects 3. Managing Your Workspace 4. Basic Expressions 5. Working with Basic Objects 6. Working with Strings 7. Working with Data 8. Inside R 9. Metaprogramming 10. Object-Oriented Programming 11. Working with Databases 12. Data Manipulation 13. High-Performance Computing 14. Web Scraping 15. Boosting Productivity

Using regular expressions


For research, you may need to download data from open-access websites or authentication-required databases. These data sources provide data in various formats, and most of the data supplied are very likely well-organized. For example, many economic and financial databases provide data in the CSV format, which is a widely supported text format to represent tabular data. A typical CSV format looks like this:

id,name,score 
1,A,20 
2,B,30 
3,C,25

In R, it is convenient to call read.csv() to import a CSV file as a data frame with the right header and data types because the format is a natural representation of a data frame.

However, not all data files are well organized, and dealing with poorly organized data is painstaking. Built-in functions such as read.table() and read.csv() work in many situations, but they may not help at all for such format-less data.

For example, if you need to analyze raw data (messages.txt) organized in a CSV-like format as shown...

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 €14.99/month. Cancel anytime}