In this video, Mark Niemann-Ross demonstrates the use of functions from the foreign package to import SPSS data files. Learn how to use read.spss and write.foreign.
- SPSS is a tremendously popular tool…and there is a lot of statistical data available from it.…R provides a simple way to import SPSS data…into R and let's take a look at that.…The first thing you'll want to do is…make sure the foreign library is available…and for that you use the library foreign command.…When you've done that you will have read.spss available…and here's how it works.…You create a vector, we'll call it readFromSPSS.…
And into that vector we're going…to place the results of read.spss.…The first thing you need to tell read.spss…is where to find the file that you want to import.…And in this case be sure that you set…your current working directory to Chapter 3.…I'm going to select a file from the sample files folder,…I'm going to select spssSample.sav…and by the way, read.spss requires a .sav.…
SPV files won't work.…Once I've selected the file I want to import…I also need to tell it that I want…to import this to a data frame…so I'll us to.data.frame = TRUE.…And when I run that command you'll see that I now…
- Challenges and characteristics of high-variety data
- Using R with Excel
- Exporting an R data structure to an Excel workbook
- Importing text, CSV, and tab-delimited files
- Working with the R foreign package
- Using R with XML files, HTML files, and Google Docs
- Working with images 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.