SCF data

- 1 min

Overview:

Play with SCF data in R.


Import data:

1. Package

devtools::install_github( "ajdamico/lodown" , dependencies = TRUE )

Enter 3 (for none). Denying the update to save time.

2. Download data

library(lodown)
lodown( "scf" , output_dir = file.path( path.expand( "~" ) , "SCF" ) )

It takes about 30 mins to download all the data which will be stored as RDS files.

3. Catalog

scf_cat <-
  get_catalog( "scf" ,
               output_dir = file.path( path.expand( "~" ) , "SCF" ) )

Get the catalog of available microdata.

4. Example

setwd("~/SCF")
data_1989 <- readRDS("scf 1989 rw.rds")

Here I get the SCF data in 1989. It looks clean and tidy.

dim.data.frame(data_1989)
> 3143 1000

It has 3143 observations and 1000 variables. And we have other similar data sets from 1989 to 2016. “The world is your oyster.”


Next

With everything in our hand, we can impute missing value, manipulate the data set, extract variables and observations we want, and do some analysis and modeling. ✌️


Reference

SCF bulletin SCF tech document
asdfree.com | analyze scf with r
Code book

Guidance of Analyzing Survey Data

Complex sampling and R

Zhijian Liu

Zhijian Liu

A foodaholic

comments powered by Disqus
rss facebook twitter github gitlab youtube mail spotify lastfm instagram linkedin google google-plus pinterest medium vimeo stackoverflow reddit quora quora