ReadCsvNlsy79 {NlsyLinks} | R Documentation |
Read a CSV file downloaded from the NLS Investigator
Description
The function accepts a (file path to) CSV file and creates a base::data.frame. The base::data.frame is modified and augmented with columns to assist later routines.
Usage
ReadCsvNlsy79Gen1(filePath, dsExtract = utils::read.csv(filePath))
Arguments
filePath |
A path to the CSV file. Remember to use double back-slashes in Windows, or forward-slashes in Windows or Linux. |
dsExtract |
A 'data.frame' (containing the extract) can be passed instead of the file path if the data has already been read into R's memory. |
Details
The function does seven things.
Reads the CSV into a base::data.frame.
Checks that the NLSY variables
C00001.00
andC00002.00
exist in the base::data.frame.The NLSY variable
C00001.00
is renamedSubjectID
.A variable named
Generation
is given a value of 2 for all subjects.The
SubjectTag
variable is created.The NLSY variable
C00002.00
is multiplied by 100 and renamedSubjectTagOfMother
.The NLSY variable
R00001.49
(ie, their Mother'sHHID
is attached to each Gen2 record).
Value
A base::data.frame to facilitate biometric analysis.
Author(s)
Will Beasley
Examples
## Not run:
filePathGen2 <- "~/Nlsy/Datasets/gen2-birth.csv"
ds <- ReadCsvNlsy79Gen2(filePath = filePathGen2)
## End(Not run)