In this video, Mark Niemann-Ross demonstrates importing fixed-width files (FWF) into R data objects. Learn how to use base R and the tidyverse to import FWF with read.fwf and read_fwf.
- [Instructor] Fixed-Width Files or FWF…are files where each field is exactly the same width.…And I can show you this if you go into the samples file…and open up LPO_weather.tdf or tab-delimited.…Also open up weather.fwf.…If you look at LPO_weather.tdf,…and in particular line five and six,…you'll see that 280.80…in line five and 80.60…line up on the left-hand side.…
If you look at the fixed-width version…on line five and six,…you'll see that 280…and 80.6…don't line up,…they line up according to the decimal point…and that's because there is a fixed width space…making sure that each field is exactly the same width.…So, how do you import this data?…Well, as you might guess, there are two ways.…One is with the base R version…and one is with the tidyverse.…To do this, the first thing I'm going to do…is create a vector called sampleFWF…and I'm going to put a file named into that.…
I'm also going to create fwfFieldPositions…and that contains a vector…of all of the widths of the fields,…and I've already calculated that before we started talking.…
- Name the three types of big data.
- List three considerations used to determine the appropriate R package for Excel.
- Determine the best package used to import entire Excel workbooks.
- Explain how to import standard text files using base R and tidyverse.
- Define the purpose of the foreign language package for R.
- Recognize restrictions when working on SAS files in the foreign language package.
- Identify the problems involved with extracting data from a PDF in R.
Skill Level Intermediate
R Programming in Data Science: High Volume Datawith Mark Niemann-Ross1h 25m Intermediate
1. Use R with Excel
2. Importing Text Files
3. Understanding the Foreign Package
4. Use R with Popular Data Formats
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.