// globals

function preprocess () {
vars = str_replace ("\n", ",", trim (getValue ("x"))) ;

echo ('data <- data.frame (' + vars + ', check.names=FALSE)\n');
echo ('datadescription <- paste (rk.get.description (' + vars + '), collapse=", ");\n');
}

function calculate () {
echo ('result <- ftable (data'); if (!getValue ("exclude_nas.state")) echo (", exclude=NULL" + ');\n');
}

function printout () {
echo ('rk.header ("Crosstabs (n to n)", parameters=list ("Variables"=datadescription))\n');
echo ('\n');
echo ('rk.print (result)\n');
}

