Learn R Programming

bnpa (version 0.3.0)

check.ordered.one.var: Verify if one specific variable of a data set is an ordered factor

Description

Receives a data set, the name of a specific variable and verify if it is an ordered factor or not. If 'yes' then the function return TRUE.

Usage

check.ordered.one.var(data.to.work, var.name)

Arguments

data.to.work

is a data set containing the variables to be checked.

var.name

is the name of variable to be checked.

Value

TRUE or FALSE

References

HAYES, A F; PREACHER, K J. Statistical mediation analysis with a multicategorical independent variable. British Journal of Mathematical and Statistical Psychology, v. 67, n. 3, p. 451-470, 2014.

Examples

Run this code
# NOT RUN {
# Clean environment
closeAllConnections()
rm(list=ls())
# Set enviroment
# setwd("to your working directory")
# Load packages
library(bnpa)
# Use working data sets from package
data(dataQualiN)
head(dataQualiN)
# Transform variable A into ordered factor
dataQualiN$A <- ordered(dataQualiN$A)
# Check variable A and return TRUE
var.name <- "A"
check.ordered.one.var(dataQualiN, var.name)
# Check variable B and return FALSE
var.name <- "B"
check.ordered.one.var(dataQualiN, var.name)
# }

Run the code above in your browser using DataLab