Description Usage Arguments Details Value Author(s)
A collection of functions that helps data management data.frame
s, particularly those derived from NLSY Extracts.
1 2 3 4 5 | VerifyColumnExists( dataFrame, columnName )
RenameColumn( dataFrame, oldColumnName, newColumnName )
RenameNlsyColumn( dataFrame, nlsyRNumber, newColumnName )
|
dataFrame |
The |
columnName |
The name of the column to verify is present in the |
nlsyRNumber |
The name of the column to change. |
oldColumnName |
The name of the column to change. |
newColumnName |
The desired name of the column. |
The RNumber assigned by the NLS has a pattern. In the Nlsy79 Gen1 dataset, the names start with a ‘R’ or ‘T’ and are followed by seven digits (eg, R0000100). In the Nlsy79 Gen2 dataset, the names start with ‘C’ or ‘Y’ and are followed by seven digits (eg, C0007030, Y1994600).
In the NLS Investigator, a decimal is present in the RNumber (eg, R00001.00). When the Investigator saves the dataset as a CSV, the decimal is removed (eg, R0000100).
*IMPORTANT* The RenameColumn
and RenameNlsyColumn
functions do not use side-effects to rename the data.frame
. Instead, it returns a new data.frame
. In the example below, notice the assignment to ds
: ds <- RenameNlsyColumn(...)
.
The VerifyColumnExists
function check that exactly one column exists with the specified columnName
. If so, the index of the column is returned. If not, an exception is thrown.
Will Beasley
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.