R/item.length.R

Defines functions item.length

Documented in item.length

#' Test the length of the name of items.
#'
#' @description Allows for users to test the length of items so they can be shortened if neccessary.
#' 
#' @param OCstack A stacked dataset of the CRFs see read.forms
#' @param length The maximum item name length desired
#' @param type can be item, description, or label.
#'
#' @author Tyler Hunt \email{[email protected]@utah.edu}

item.length<-function(OCstack, length=32, type="item"){
  
  if(type=="item"){
  items<-as.character(OCstack$ITEM_NAME)
  }
  
  if(type=="description"){
    items<-as.character(OCstack$DESCRIPTION_LABEL)
  }
  
  if(type=="label"){
    items<-as.character(OCstack$RESPONSE_LABEL)
  }
  
  items[nchar(items)>length]
}
JackStat/OCtesting documentation built on May 8, 2017, 11:20 p.m.