cspro.factor.type = 1
cspro.factor.create.new.variable = FALSE
# CSPro Export Factor Options:
# cspro.factor.type (0): do not use factors
# cspro.factor.type (1): factor only discrete numeric variables
# cspro.factor.type (2): factor both discrete numeric and alpha variables
# cspro.factor.create.new.variable: TRUE to add the factored variables as separate variables
exported <- read.fortran("C:/MySurvey/Exported.dat",c("I1","I1"))
names(exported) <- c("relationship","sex")
if( cspro.factor.type != 0 )
{
if( cspro.factor.create.new.variable ) exported$relationship.f <- factor(exported$relationship,levels = c(1,2,3,4,5),labels = c("Head","Spouse","Child","Other Relative","Non-Relative"))
else exported$relationship <- factor(exported$relationship,levels = c(1,2,3,4,5),labels = c("Head","Spouse","Child","Other Relative","Non-Relative"))
if( cspro.factor.create.new.variable ) exported$sex.f <- factor(exported$sex,levels = c(1,2),labels = c("Male","Female"))
else exported$sex <- factor(exported$sex,levels = c(1,2),labels = c("Male","Female"))
}
rm(cspro.factor.type)
rm(cspro.factor.create.new.variable)