CleanFreeList: CleanFreeList

View source: R/CleanFreelist.R

CleanFreeListR Documentation

CleanFreeList

Description

Given a Free list dataset with Codes, Ordering and subject numbers, remove incorrectly entered subjects, detect duplicate codes, remove blank codes, and enforce sequential ranking.

Usage

CleanData<-CleanFreeList(mydata, Order="Order",Subj="Subj",CODE="CODE",ejectBadSubj=T,deleteDoubleCode=T,ConsolidateOrder=T,RemoveMissingData=T)

Arguments

mydata

The free-list data. This should be a data frame, where each row contains a single response from a single respondent. For each such response, you need to know the subject number (or some form of unique identifier), the response (or "CODE" of the response and the ranking/order of the response (What was this respondents the first response? The second? The Seventeenth?). The "CODE" of the response is the target variable. We use "code" here as some free-list data gets coded into another coding scheme.

Order

This is the name of the column which contains the "Order" information. For each subject responses should be ordered uniquely from 1 to N, where N is the number of responses. There should be no gaps or double ups. Defaults to "Order"

Subj

This is the name of the column containing your subject names/numbers. Each subject should have a unique identifier in this column (Is this confusing, given that each subject may take several rows?). Defaults to "Subj".

CODE

This is the name of the column containing your subject names/numbers. Each subject should have a unique identifier in this column (Is this confusing, given that each subject may take several rows?). Defaults to "Subj".

ejectBadSubj

Do you want to eject all subjects who have (for whatever reason) bad data? For example duplicates or missing order entries. defaults to true.

deleteDoubleCode

If someone says "Apple" twice, do you want to drop all but the first instance? Defaults to False.

ConsolidateOrder

Do you want to "consolidate" order data. EG: 1 2 5 7-> 1 2 3 4. Useful if you intend to be removing some rows.

RemoveMissingData

Remove any row where Code is NA, or blank.

Value

A new free list dataframe, with all the requested error types removed. (NOTE, the effect that such removal will have on your statistics is unknown. We believe this method makes sensible modifications, but advise the use of caution.)

Examples

data(UglyList)
View(CleanFreeList(UglyList))
View(CleanFreeList(UglyList,deleteDoubleCode=T))
View(CleanFreeList(UglyList,ejectBadSubj=F))


alastair-JL/AnthroTools documentation built on Aug. 29, 2024, 9:36 a.m.