RwebDistribution/ 40755 1051 63 0 6673263750 13630 5 ustar deleeuw faculty RwebDistribution/CGIFiles/ 40755 1051 63 0 6673263746 15222 5 ustar deleeuw faculty RwebDistribution/CGIFiles/.Rprofile 100644 1051 63 12120 6673263744 17114 0 ustar deleeuw faculty .First <- function(){
options(prompt="Rweb:> ")
}
webpairs <- function (x, labels, panel = points, main = NULL, font.main = par("font.main"),
cex.main = par("cex.main"), ...)
{
if (!is.matrix(x))
x <- data.matrix(x)
if (!is.numeric(x))
stop("non-numeric argument to pairs")
nc <- ncol(x)
if (nc < 2)
stop("only one column in the argument to pairs")
if (missing(labels)) {
labels <- dimnames(x)[[2]]
if (is.null(labels))
labels <- paste("var", 1:nc)
}
oma <- c(4, 4, 4, 4)
if (!is.null(main))
oma[3] <- 6
opar <- par(mfrow = c(nc, nc), mar = rep(0.5, 4), oma = oma)
on.exit(par(opar))
for (i in 1:nc) for (j in 1:nc) {
if (i == j) {
plot(x[, j], x[, i], xlab = "", ylab = "",
axes = FALSE, type = "n", ...)
box()
text(mean(par("usr")[1:2]), mean(par("usr")[3:4]),
labels[i], cex=3)
}
else {
plot(x[, j], x[, i], type = "n", xlab = "",
ylab = "", axes = FALSE, ...)
box()
panel(x[, j], x[, i], ...)
}
if (j == 1 & 2 * floor(i/2) == i)
axis(2)
if (i == 1 & 2 * floor(j/2) == j)
axis(3)
if (j == nc & 2 * floor(i/2) != i)
axis(4)
if (i == nc & 2 * floor(j/2) != j)
axis(1)
}
if (!is.null(main))
mtext(main, 3, 3, T, 0.5, cex = cex.main/par("cex"),
font = font.main)
invisible(NULL)
}
interactionPlot <- function(aov.object){
model <- aov.object$model
drawInteractionPlot(model)
drawInteractionPlot(model[,c(1,3,2)])
}
drawInteractionPlot <- function(model){
varnames <- names(model)
means <- tapply(model[,1],model[,2:3],mean)
levels1 <- levels(model[,2])
levels2 <- levels(model[,3])
n1 <- length(levels1)
n2 <- length(levels2)
f1 <- 1:n1
f2 <- 1:n2
delta <- (max(f1) - min(f1))*.2
newx <- rep(f1,n2)
newx <- ifelse(newx == n1, newx + delta, newx)
par(cex=1.5)
plot(newx, as.vector(means),
xlab = "",
ylab = paste("Mean values of", varnames[1]),
type="n", xaxt = "n")
points(rep(f1,n2), as.vector(means))
title(main="Interaction Plot", cex=2)
par(cex=1.5)
for (i in 1:n2){
lines(f1,means[,i])
}
text(rep(f1[n1], n2) + delta/2, means[n1,], levels2)
for (i in 1:n1){
mtext(levels1[i], 1, 0, outer=F, at=f1[i])
}
mtext(paste("Lines represent the levels of", varnames[3]), 3, 0)
mtext(paste("This axis represents the levels of", varnames[2]), 1, 1)
par(cex=1)
}
## Functions for two way tables
printIt <- function(m,label){
cat("\n")
cat("##################################################")
cat(paste("\n", label, "\n", sep=""))
print(signif(m, 4))
cat("##################################################")
cat("\n")
cat(" ")
cat("\n")
}
twoWay <- function( x=NA, y=NA, userDefined=NA ){
if (is.na(userDefined)){
result <- chisq.test(table(x,y))
}
else{
result <- chisq.test(userDefined)
}
print (result)
observed <-result$observed
expected <- result$expected
chi.table <- ((observed - expected)^2)/expected
row.sum <- apply(observed,1,sum)
col.sum <- apply(observed,2,sum)
N <- sum(observed)
## put in the marginals and names ... create fullArray
fullArray <- cbind(observed,row.sum)
fullArray <- rbind(fullArray,c(col.sum,N))
rownames(fullArray) <- c(rownames(observed), "Total")
colnames(fullArray) <- c(colnames(observed), "Total")
## make the tables of proportions
proportion <- fullArray/N
row.proportion <- fullArray/c(row.sum,N)
col.proportion <- t(t(fullArray)/c(col.sum, N))
return(list(fA=fullArray, e=expected, ct=chi.table, p=proportion, rp=row.proportion, cp=col.proportion))
}
bonferroni <- function(fm){
# only for one-way ANOVA
x <- fm$model[,2]
factorNames_sort(unique(x))
df <- fm$df.residual
alpha <- .1
k <- length(factorNames)
numberOfComparisons <- choose(k, 2)
CI <- matrix(data="", ncol=k, nrow=k)
dimnames(CI) <- list(factorNames, factorNames)
means <- coef(fm)
for (i in 2:k){means[i] <- means[i] + means[1]}
s <- sqrt(anova(fm)$table[2,3])
tStat <- abs(qt(alpha/(2*numberOfComparisons), df))
for (i in 1:(k - 1)){
for (j in (i+1):k){
diffMeans <- means[i] - means[j]
ni <- length(x[x == factorNames[i]])
nj <- length(x[x == factorNames[j]])
halfWidth <- tStat * s * sqrt((1/ni) + (1/nj))
ul <- diffMeans + halfWidth
ll <- diffMeans - halfWidth
ul <- signif(ul,3)
ll <- signif(ll,3)
CI[i,j] <- paste("(", ll, ", ", ul,")", sep="")
}
}
cat("\n Bonferroni Multiple Comparison Confidence Intervals \n for the Difference Between Means\n\n")
print(CI, quote=F, digits=1)
}
RwebDistribution/CGIFiles/AnalysisModules/ 40755 1051 63 0 6673263744 20334 5 ustar deleeuw faculty RwebDistribution/CGIFiles/AnalysisModules/runANOVA.cgi 100644 1051 63 5763 6673263744 22521 0 ustar deleeuw faculty #!/usr/local/bin/perl -w
require "../globalVariables";
require "../Rweb.pm";
$identifier = $$;
&createTempFiles; # For data, output, ...
&ReadParse;
$time = time();
$dataInput = bringInData (\%in);
&inputStuff($dataInput);
if ( $LOGFILE ) {
open (logFile, ">> log.ANOVA");
print logFile "Host:$ENV{'REMOTE_HOST'}%Address:$ENV{'REMOTE_ADDR'}%Browser:$ENV{'HTTP_USER_AGENT'}%Time:$time\n";
close(logFile);
}
print "Content-type: text/html\n\n";
print "
ANOVA Results
";
print "
\n";
## open up the file for storing the R code
open (RoutFile, "> $FCode");
select(RoutFile); # it's now the default for printing
print ("postscript(file= \"$FOutputPS\", height = 6, width = 8)\n");
print("$input{'code'} \n"); # code to load and setup data
############################################################
####### Write out the R code for the analysis
# Check for response and factors before running analysis
if (defined($in{'response'}) && defined($in{'factor'})){
$response = $in{'response'};
$factors = $in{'factor'};
@factors = split(/, /, $factors);
$formula = $factors;
# error checking
if ($factors =~ /$response/){
print STDOUT "
You shouldn't include the response as a factor!
";
close(RoutFile);
&RwebExit;
die;
}
# make sure the factors are of type factor
foreach $var (@factors){
print "$var <- as.factor($var) \n";
}
# include interaction term?
if (defined($in{'interaction'})){
$formula =~ s/, /*/g;
}
else{$formula =~ s/, / + /g;}
# R code for building the analysis object
print "aov.object <- lm($response ~ $formula) \n";
# Print the ANOVA table?
if (defined($in{'table'})){
print "anova(aov.object) \n";
}
# Print the means table?
if (defined($in{'means'})){
if ($#factors > 0){
print "print(tapply($response, list($factors), mean)) \n";
}
foreach $var (@factors){
print "print(tapply($response, $var, mean)) \n";
}
}
# Make the interaction plots?
if (defined($in{'interactionplot'}) && ($#factors > 0)){
print "interactionPlot(aov.object) \n";
}
# Multiple Comparisons?
if (defined($in{'multiplecomparison'}) && ($#factors < 1)){
print "bonferroni(aov.object) \n";
#print STDOUT "
Multiple Comparisons not Implemented Yet
\n";
}
}
else{
print STDOUT "
You Must choose a response variable and factor(s)
";
}
############################################################
####### end of R code output
close(RoutFile);
###########################################################################
# Now run R in batch mode using the saved commands as the input.
# Output goes into another file that is then read back in and displayed,
# it would be better to do this without the output file but I can't get
# the output to sinc up with the rest of the code ...
&runR;
&printResults;
# Process the postscript file, create gif files and write the necessary code
# into a new Rgif* html file ... this all happens in the $TMPDIR directory
&processPostscript;
&RwebExit;
RwebDistribution/CGIFiles/AnalysisModules/runProbability.cgi 100644 1051 63 3623 6673263744 24126 0 ustar deleeuw faculty #!/usr/local/bin/perl -w
require "../globalVariables";
require "../Rweb.pm";
$identifier = $$;
&createTempFiles; # For data, output, ...
&ReadParse;
$time = time();
if ( $LOGFILE ) {
open (logFile, ">> log.Probability");
print logFile "Host:$ENV{'REMOTE_HOST'}%Address:$ENV{'REMOTE_ADDR'}%Browser:$ENV{'HTTP_USER_AGENT'}%Time:$time\n";
close(logFile);
}
################################################################
## open up the file for storing the R code
open (RoutFile, "> $FCode");
print "Content-type: text/html\n\n";
print "
Probability Results
\n";
####### check for which probabilities they want #########
if( $in{'normalk'} =~ /\d/){
print RoutFile ("# CUMULATIVE NORMAL DISTRIBUTION \n");
print RoutFile ("pnorm($in{'normalk'}, $in{'normalmu'}, $in{'normalsigma'}) \n");
}
if( $in{'tk'} =~ /\d/){
print RoutFile ("# CUMULATIVE T DISTRIBUTION \n");
print RoutFile ("pt($in{'tk'}, $in{'tdf'}) \n");
}
if( $in{'binomialcdfk'} =~ /\d/){
print RoutFile ("# CUMULATIVE BINOMIAL DISTRIBUTION \n");
print RoutFile ("pbinom($in{'binomialcdfk'}, $in{'binomialcdfn'}, $in{'binomialcdfp'}) \n");
}
if( $in{'binomialpdfk'} =~ /\d/){
print RoutFile ("# CUMULATIVE BINOMIAL DISTRIBUTION \n");
print RoutFile ("dbinom($in{'binomialpdfk'}, $in{'binomialpdfn'}, $in{'binomialpdfp'}) \n");
}
if( $in{'chisqk'} =~ /\d/){
print RoutFile ("# UPPER TAIL PROBABILITIES FOR CHI SQUARE DISTRIBUTION \n");
print RoutFile ("1-pchisq($in{'chisqk'}, $in{'chisqdf'}) \n");
}
close(RoutFile);
###########################################################################
# Now run R in batch mode using the saved commands as the input.
# Output goes into another file that is then read back in and displayed,
# it would be better to do this without the output file but I can't get
# the output to sinc up with the rest of the code ...
&runR;
&printResults;
&RwebExit;
RwebDistribution/CGIFiles/AnalysisModules/runRegression.cgi 100644 1051 63 11711 6673263744 24003 0 ustar deleeuw faculty #!/usr/local/bin/perl -w
require "../globalVariables";
require "../Rweb.pm";
$identifier = $$;
&createTempFiles; # For data, output, ...
&ReadParse;
$time = time();
$dataInput = bringInData (\%in);
&inputStuff($dataInput);
if ( $LOGFILE ) {
open (logFile, ">> log.Regression");
print logFile "Host:$ENV{'REMOTE_HOST'}%Address:$ENV{'REMOTE_ADDR'}%Browser:$ENV{'HTTP_USER_AGENT'}%Time:$time\n";
close(logFile);
}
$goodModel = True;
if (defined($in{'intercept'})){
$intercept ="T";
}
else{$intercept = "F";}
print "Content-type: text/html\n\n";
print "
Regression Results
";
####### check for response/predictor errors
if (defined($in{'response'})){
$response = $in{'response'};
if (defined($in{'predictors'})){
foreach $predictor (split(/, /,$in{'predictors'})){
if ($response eq $predictor){
print("
ERROR
\n");
print("You have the response as one of the predictors.\n");
print("This is not considered good form in Regression.\n");
print("
ERROR
\n");
$goodModel = False;
}
}
}
else {
print("
ERROR
\n");
print("You have a response but no predictors ... \n");
print("It is hard to build a good regression models this way.\n");
print("
ERROR
\n");
$goodModel = False;
}
} # end of options if response is defined
elsif (defined($in{'predictors'})){
print("
ERROR
\n");
print("You have predictors but no response variable ...\n");
print("It is hard to fit an undefined response.\n");
print("
ERROR
\n");
$goodModel = False;
}
######## end of checks for response/predictor errors.
# If $goodModel is True you have a good model ... it passed all of the above checks
# Now writeout the R code for whatever options have been selected.
## open up the file for storing the R code
open (RoutFile, "> $FCode");
select(RoutFile); # it's now the default for printing
print ("postscript(file= \"$FOutputPS\", height = 6, width = 8)\n");
print("$input{'code'} \n"); # code to load and setup data
#####all of the coding for the regression Model
if ($goodModel eq 'True'){
print STDOUT ("
Response: $response
\n");
print STDOUT ("
Predictors: $in{'predictors'}
\n");
$predictorFormula = $in{'predictors'};
$predictorFormula =~ s/,/ + /g;
if (defined($in{'intercept'})){
print("str <- lm($response ~ $predictorFormula) \n");
}
else {print("str <- lm($response ~ $predictorFormula -1) \n");}
print("residuals <- residuals(str) \n");
print("predicted <- fitted.values(str) \n");
print("summary(str) \n");
## Automatic inclusion of x vs y plots with fitted line
if (defined($in{'slrplots'})){
foreach $varname (split(/, /, $in{'predictors'})){
print("plot($varname, $response, main=\"SLR Plot of $varname vs $response\") \n");
if (defined($in{'intercept'})){
print("abline(lm($response ~ $varname)) \n");
}
else {print("abline(lm($response ~ $varname -1)) \n");}
}
}
### now check for residual plot requests
if(defined($in{'resid'})){
@residplots = split(/, /,$in{'resid'});
foreach $plot (@residplots){
if ($plot eq 'qq') {print("qqnorm(residuals) \nqqline(residuals) \n");}
if ($plot eq 'hist') {print("hist(residuals) \n");}
if ($plot eq 'predicted') {print("plot(predicted, residuals, main=\"Predicted vs Residual\") \n abline(h=0) \n");}
}
}
### now check for residual versus predictor plots
if(defined($in{'residvspredictor'})){
@vars = split(/, /,$in{'residvspredictor'});
foreach $var (@vars){
print("plot($var, residuals, main=\"$var vs Residual\") \n lines(lowess($var, residuals)) \n");
}
}
}
##### End of Modeling and residual code
# plot requested histograms
if(defined($in{'hist'})){
@vars = split(/, /,$in{'hist'});
foreach $var (@vars){
print("hist($var) \n");
}
}
# plot requested scatterplot ... this is done with pairs
# so they get all pairwise scatterplots for requested variables
if(defined($in{'scatterplot'})){
foreach $varname (split(/, /, $in{'scatterplot'})){
$varNames .= "\"$varname\", ";
}
$varNames =~ s/, $//; # remove last , and space ... it will screw up R
print("pairs.var <- data.frame($in{'scatterplot'}) \n");
# print("dimnames(pairs.var)[[2]] <- c($varNames) \n");
print("webpairs(pairs.var) \n");
}
close(RoutFile);
###########################################################################
# Now run R in batch mode using the saved commands as the input.
# Output goes into another file that is then read back in and displayed,
# it would be better to do this without the output file but I can't get
# the output to sinc up with the rest of the code ...
&runR;
&printResults;
# Process the postscript file, create gif files and write the necessary code
# into a new Rgif* html file ... this all happens in the $TMPDIR directory
&processPostscript;
&RwebExit;
RwebDistribution/CGIFiles/AnalysisModules/runSummary.cgi 100644 1051 63 7407 6673263744 23307 0 ustar deleeuw faculty #!/usr/local/bin/perl -w
require "../globalVariables";
require "../Rweb.pm";
$identifier = $$;
&createTempFiles; # For data, output, ...
&ReadParse;
$time = time();
$dataInput = bringInData (\%in);
&inputStuff($dataInput);
if ( $LOGFILE ) {
open (logFile, ">> log.Summary");
print logFile "Host:$ENV{'REMOTE_HOST'}%Address:$ENV{'REMOTE_ADDR'}%Browser:$ENV{'HTTP_USER_AGENT'}%Time:$time\n";
close(logFile);
}
if (defined($in{'smoothscatter'})){
$smoothscatter ="T";
}
else{$smoothscatter = "F";}
print "Content-type: text/html\n\n";
print "
Summary Results
";
## open up the file for storing the R code
open (RoutFile, "> $FCode");
select(RoutFile); # it's now the default for printing
print ("postscript(file= \"$FOutputPS\", height = 6, width = 8)\n");
print("$input{'code'} \n"); # code to load and setup data
############################################################
####### numerical summaries ... only if we have selected variables
if (defined($in{'analysisvariables'})){
$variables = $in{'analysisvariables'};
$analysis = $in{'analysis'};
## R code that lets us just use the R data frame "variables" and everything should
## be labeled properly
print("variables <- data.frame($variables) \n");
if ($analysis =~ /fivenumber/){
print "summary(variables) \n";
print "var(variables) \n";
}
if ($analysis =~ /correlation/){
print "cor(variables) \n";
}
}
############################################################
####### end of numerical summaries
############################################################
####### graphical summaries ... only if we have selected variables
if (defined($in{'graphvariables'})){
$variables = $in{'graphvariables'};
@variables = split(/, /, $variables);
$graphs = $in{'graph'};
$splitvariable = $in{'split'};
## R code that lets us just use the R data frame "variables" and everything should
## be labeled properly
print("variables <- data.frame($variables) \n");
## plots that have to be done individually ... at least I can't figure out how
## to do them using pairs
foreach $var (@variables){
if ($graphs =~ /histogram/){
print "hist($var) \n";
}
if ($graphs =~ /qqplotnorm/){
print "qqnorm($var) \n";
print "qqline($var) \n";
}
if ($graphs =~ /timeseries/){
print "plot($var, type=\"b\") \n";
}
if ($graphs =~ /boxplot/){
print "boxplot(split($var, $splitvariable)) \n";
print "title(main= \" $var split on $splitvariable \") \n";
}
}
## Plots that can be graphed in the pairs format
if ($graphs =~ /qqplotpair/){
print "webpairs(variables, panel=function(x1, x2){points(sort(x1),sort(x2))}) \n";
}
if ($graphs =~ /scatterplot/){
# check for only one variable ... then do time series plot
if ($#variables == 0){
if (defined($in{'smoothscatter'})){
print "plot($variables) \n";
print "lines(lowess(1:length($variables), $variables)) \n";
}
else {print "plot($variables, type=\"b\") \n";}
}
elsif (defined($in{'smoothscatter'})){
print "webpairs(variables, panel=function(x,y){points(x,y);lines(lowess(x,y))}) \n";
}
else {print "webpairs(variables) \n";}
}
}
############################################################
####### end of graphical summaries
close(RoutFile);
###########################################################################
# Now run R in batch mode using the saved commands as the input.
# Output goes into another file that is then read back in and displayed,
# it would be better to do this without the output file but I can't get
# the output to sinc up with the rest of the code ...
&runR;
&printResults;
# Process the postscript file, create gif files and write the necessary code
# into a new Rgif* html file ... this all happens in the $TMPDIR directory
&processPostscript;
&RwebExit;
RwebDistribution/CGIFiles/AnalysisModules/runTwoWay.cgi 100644 1051 63 5635 6673263744 23105 0 ustar deleeuw faculty #!/usr/local/bin/perl -w
require "../globalVariables";
require "../Rweb.pm";
$identifier = $$;
&createTempFiles; # For data, output, ...
&ReadParse;
$time = time();
$dataInput = bringInData (\%in);
&inputStuff($dataInput);
if ( $LOGFILE ) {
open (logFile, ">> log.ChiSquare");
print logFile "Host:$ENV{'REMOTE_HOST'}%Address:$ENV{'REMOTE_ADDR'}%Browser:$ENV{'HTTP_USER_AGENT'}%Time:$time\n";
close(logFile);
}
print "Content-type: text/html\n\n";
print "
Two Way Table Results
";
## open up the file for storing the R code
open (RoutFile, "> $FCode");
select(RoutFile); # it's now the default for printing
print ("postscript(file= \"$FOutputPS\", height = 6, width = 8)\n");
if ($in{'Table'}){
print STDOUT "Using User Defined Table \n";
$tableData = $in{'Table'};
$rowNames = $in{'rowNames'};
$colNames = $in{'colNames'};
$tableData =~ s/,/ /g;
$tableData =~ s/\s+/, /g;
chomp($tableData);
# print "$tableData \n";
$rowNames =~ s/,/ /g;
$rowNames =~ s/(\S+)/\"\1\"/g;
$rowNames =~ s/\s+/, /g;
chomp($rowNames);
# print "$rowNames \n";
$colNames =~ s/,/ /g;
$colNames =~ s/(\S+)/\"\1\"/g;
$colNames =~ s/\s+/, /g;
chomp($colNames);
# print "$colNames \n";
$count = split /,/, $colNames;
print "inputTable <- matrix(c($tableData), ncol = $count, byrow=T) \n";
print "rownames(inputTable) <- c($rowNames) \n";
print "colnames(inputTable) <- c($colNames) \n";
# print "inputTable \n";
print "twoWayOutput <- twoWay(userDefined = inputTable) \n ";
}
else {
print("$input{'code'} \n"); # code to load and setup data
print "twoWayOutput <- twoWay(x = $in{'rowVariable'}, y = $in{'colVariable'}) \n ";
}
############ Options for which tables to print
if (defined($in{'observed'})) {
print "printIt(twoWayOutput\$fA, \"Table of Observed Values and Marginal Totals\") \n";
}
if (defined($in{'expected'})) {
print "printIt(twoWayOutput\$e, \"Table of Expected Values\") \n";
}
if (defined($in{'chisq'})) {
print "printIt(twoWayOutput\$ct, \"Table of Chi-Square Values\") \n";
}
if (defined($in{'percent'})) {
print "printIt(100*twoWayOutput\$p, \"Table of Percents\") \n";
}
if (defined($in{'row'})) {
print "printIt(100*twoWayOutput\$rp, \"Table of Row Percents\") \n";
}
if (defined($in{'col'})) {
print "printIt(100*twoWayOutput\$cp, \"Table of Column Percents\") \n";
}
close(RoutFile);
###########################################################################
# Now run R in batch mode using the saved commands as the input.
# Output goes into another file that is then read back in and displayed,
# it would be better to do this without the output file but I can't get
# the output to sinc up with the rest of the code ...
&runR;
&printResults;
# Process the postscript file, create gif files and write the necessary code
# into a new Rgif* html file ... this all happens in the $TMPDIR directory
&processPostscript;
&RwebExit;
RwebDistribution/CGIFiles/AnalysisModules/setupANOVA 100644 1051 63 3007 6673263744 22301 0 ustar deleeuw faculty print << "ending_print_tag";
ending_print_tag
RwebDistribution/CGIFiles/buildAnalysisPage.cgi 100644 1051 63 3060 6673263745 21401 0 ustar deleeuw faculty #!/usr/local/bin/perl -w
require "globalVariables";
require Rweb;
$identifier = $$;
&createTempFiles; # For data, output, ...
print "Content-type: text/html\n\n";
print "Dataset and Analysis\n";
print "";
print "\n \n You are using the Rweb server at $SERVER \n \n";
# Read in the forms data ... %in will be indexed by "dataname" and "analysis"
&ReadParse;
#====================== Bringing in the Data Set ==============
$dataInput = bringInData (\%in);
#====================== Process the Input file ==============
&inputStuff ($dataInput);
$names = $input{'variables'}; # This is the only reason we have run the last 2 lines
################################################################
$dataname = $in{'dataname'};
$analysis = $in{'analysis'};
# If a description file exists, read it in and put it on the ouput page
if (-e "DataSets/$dataname.desc"){
open(descFile, "$RWEBDATA/$dataname.desc");
@fileContents = ;
close(descFile);
# If the first element is a "<" assume it is html formatted
# otherwise print it out as preformatted text
if ($fileContents[0] =~ /^){
foreach $line (@fileContents){
print $line;
}
}
else{
print "
";
}
}
$setupFile = "AnalysisModules/setup$analysis";
if ( -f $setupFile ){
do $setupFile;
}
else{
print("
");
print "\n The analysis $analysis has not been implemented \n";
print ("
")}
&RwebExit;
RwebDistribution/CGIFiles/buildModules.cgi 100644 1051 63 6637 6673263745 20446 0 ustar deleeuw faculty #!/usr/local/bin/perl -w
# This script builds the Rweb Module page. It accesses the DataSets
# subdirectory under the directory containing the cgi scripts.
require "globalVariables";
require "Rweb.pm";
print << "ending_print_tag";
Content-type: text/html
Rweb Modules
Welcome to Rweb Modules
This is the main Rweb module page.
The Rweb modules are a set of point and click interfaces to the
statistical programming language R.
There are several built in datasets which are briefly described below.
Following the dataset descriptions are two drop down menus.
One allows you to choose the type of analysis you want and, with the other
menu, you can choose the data set you want to use.
You may use any of the built in data sets, a Web accessable data set (you
need to supply the URL), or you may enter your own data.
The options for using your own data are at the bottom of the
dataset menu and the text areas for entering a URL or data follow the
drop down menus.
Once you have chosen an analysis and dataset click the submit button
to build the analysis page.
ending_print_tag
## Reading in the analyses ############
@analysisFiles = glob("AnalysisModules/setup*");
foreach $file (@analysisFiles){
$file =~ s/^AnalysisModules\/setup//;
}
## Reading in the datasets ############
@inputFiles = glob("DataSets/*.input");
foreach $file (@inputFiles){
$file =~ s/.input$//; # Cleanup the file names ... remove .input
$file =~ s/^DataSets\///;
$description{$file} = &inputStuff("DataSets/$file.input");
}
## Printing to the Returned page ############
print "
Stock automobiles containing dummies in the driver and front passenger
seats crashed into a wall at 35 miles per hour.
National Transportation Safety Board officials collected information how the crash affected
the dummies.
The injury variables describe the extent of head and chest injurie.
The datafile also contains information on the type and safety features of each crashed car.
Variable Descriptions:
Head: A measure of the head injury (large is bad)
Chest: A measure of the chest injury (large is bad)
A cost of increased reproduction in terms of reduced longevity has been
shown for female fruitflies, but not for males. The flies used were an
outbred stock. Sexual activity was manipulated by supplying individual
males with one or eight receptive virgin females per day. The
longevity of these males was compared with that of two control types.
The first control consisted of two sets of individual males kept with
one or eight newly inseminated females. Newly inseminated females will
not usually remate for at least two days, and thus served as a control
for any effect of competition with the male for food or space. The
second control was a set of individual males kept with no females.
There were 25 males in each of the five groups, which were treated
identically in number of anaesthetizations (using CO2) and provision of
fresh food medium.
Variable Descriptions:
Partners: Factor ...
Number of female companions (0, 1 or 8)
Type: Factor ...
Type of companion
0: newly pregnant female
1: virgin female
9: not applicable (when PARTNERS=0)
Longevity: Continuous ...
Lifespan in days
Thorax: Continuous ...
Length of thorax, in mm
Sleep: Continuous ...
Percentage of each day spent sleeping
A cost of increased reproduction in terms of reduced longevity has been
shown for female fruitflies, but not for males. The flies used were an
outbred stock. Sexual activity was manipulated by supplying individual
males with one or eight receptive virgin females per day. The
longevity of these males was compared with two sets of individual males kept with
one or eight newly inseminated females. Newly inseminated females will
not usually remate for at least two days, and thus served as a control
for any effect of competition with the male for food or space.
There were 25 males in each group, which were treated
identically in number of anaesthetizations (using CO2) and provision of
fresh food medium.
This is a subset of the dataset "fruitfly".
The other data set has a second control group
made up of males that had no partners but that messes up two-way ANOVA
Variable Descriptions:
Name
Type
Description
Partners
Factor
Number of female companions (1 or 8)
Type
Factor
Type of companion
0: newly pregnant female
1: virgin female
Longevity
Continuous
Lifespan in days
Thorax
Continuous
Length of thorax in mm
Sleep
Continuous
Percentage of each day spent sleeping
SOURCE:
Figure 2 in the article "Sexual Activity and the Lifespan of Male
Fruitflies" by Linda Partridge and Marion Farquhar. _Nature_, 294,
580-581, 1981.
RwebDistribution/CGIFiles/DataSets/fruitfly2.input 100644 1051 63 655 6673263745 22023 0 ustar deleeuw faculty variables:
Partners, Type, Longevity, Thorax, Sleep
&
code:
fruitfly <- read.table('DataSets/fruitfly2.data', header=T)
fruitfly$Partners <- as.factor(fruitfly$Partners)
fruitfly$Type <- as.factor(fruitfly$Type)
attach(fruitfly)
&
description:
How sleep, body size, and sexual activity effect life expectancy
in fruitflys. A subset of the fruitfly data which only includes
males that had partners.
Use for one and two-way ANOVA RwebDistribution/CGIFiles/DataSets/insect.desc 100644 1051 63 525 6673263746 21136 0 ustar deleeuw faculty The counts of insects in agricultural experimental units
treated with different insecticides. About the only use
for this data is One-Way ANOVA
VARIABLES
Name Type Description
count continuous Number of insects
spray factor Type of spray (A, B, C, D, E, F)
Reference:
McNeil, D. (1977). Interactive Data Analysis.
New York: Wiley.
RwebDistribution/CGIFiles/DataSets/insect.input 100644 1051 63 340 6673263746 21352 0 ustar deleeuw faculty variables:
count, spray
&
code:
data(insects);
attach(insects)
&
description:
The counts of insects in agricultural experimental units
treated with different insecticides. About the only use
for this data is One-Way ANOVA
RwebDistribution/CGIFiles/DataSets/OldFaithful.desc 100644 1051 63 636 6673263746 22055 0 ustar deleeuw faculty This data set has 272 observations and 2 variables; the waiting
time between eruptions and the duration of the eruption for
the Old Faithful geyser in Yellowstone National Park, Wyoming, USA.
It is interesting to look at a scatterplot of this data.
VARIABLES
Name Type Description
eruptions continuous Duration of eruption (in minutes)
waiting continuous Length of time between
eruptions (in minutes) RwebDistribution/CGIFiles/DataSets/OldFaithful.input 100644 1051 63 522 6673263746 22270 0 ustar deleeuw faculty variables:
eruptions, waiting
&
code:
data(faithful)
attach(faithful)
&
description:
This data set has 272 observations and 2 variables; the waiting
time between eruptions and the duration of the eruption for
the Old Faithful geyser in Yellowstone National Park, Wyoming, USA.
It is interesting to look at a scatterplot of this data.
RwebDistribution/CGIFiles/DataSets/PopularKids.data 100644 1051 63 55532 6673263746 22151 0 ustar deleeuw faculty Gender Grade Age Race Location School Goals Grades Sports Looks Money
boy 5 11 White Rural Elm Sports 1 2 4 3
boy 5 10 White Rural Elm Popular 2 1 4 3
girl 5 11 White Rural Elm Popular 4 3 1 2
girl 5 11 White Rural Elm Popular 2 3 4 1
girl 5 10 White Rural Elm Popular 4 2 1 3
girl 5 11 White Rural Elm Popular 4 2 1 3
girl 5 10 White Rural Elm Popular 3 4 1 2
girl 5 10 White Rural Elm Grades 3 4 2 1
girl 5 10 White Rural Elm Sports 3 2 1 4
girl 5 10 White Rural Elm Sports 4 3 2 1
girl 5 11 White Rural Elm Sports 2 3 1 4
girl 4 10 White Rural Elm Grades 2 3 4 1
boy 4 9 White Rural Elm Popular 2 3 4 1
boy 4 9 White Rural Elm Popular 4 2 3 1
boy 4 9 Other Rural Elm Popular 4 3 2 1
girl 4 9 White Rural Elm Grades 1 3 2 4
girl 4 9 White Rural Elm Sports 3 1 2 4
girl 4 9 White Rural Elm Popular 3 4 1 2
girl 4 9 White Rural Elm Grades 2 3 1 4
girl 4 9 White Rural Elm Sports 3 2 1 4
girl 4 9 White Rural Elm Popular 4 3 1 2
girl 4 9 White Suburban Brentwood Elementary Grades 1 4 2 3
girl 4 9 White Suburban Brentwood Elementary Popular 4 2 1 3
girl 4 9 White Suburban Brentwood Elementary Grades 4 3 2 1
girl 4 9 White Suburban Brentwood Elementary Popular 2 3 1 4
girl 4 10 White Suburban Brentwood Elementary Popular 2 3 1 4
girl 4 9 White Suburban Brentwood Elementary Grades 4 2 1 3
girl 4 10 White Suburban Brentwood Elementary Popular 2 3 4 1
boy 4 10 White Suburban Brentwood Elementary Grades 1 2 4 3
boy 4 10 White Suburban Brentwood Elementary Grades 2 4 3 1
boy 4 9 White Suburban Brentwood Elementary Grades 1 2 4 3
boy 4 9 White Suburban Brentwood Elementary Grades 3 1 2 4
boy 4 10 White Suburban Brentwood Elementary Grades 2 1 3 4
boy 4 11 White Suburban Brentwood Elementary Sports 3 1 2 4
boy 4 9 White Suburban Brentwood Elementary Sports 4 3 2 1
boy 4 10 White Suburban Brentwood Elementary Popular 3 2 1 4
boy 4 10 White Suburban Brentwood Elementary Sports 3 1 4 2
boy 4 10 White Suburban Brentwood Elementary Grades 2 3 1 4
boy 4 9 White Suburban Brentwood Elementary Sports 4 1 3 2
boy 4 9 White Suburban Brentwood Elementary Grades 2 1 3 4
boy 4 10 White Suburban Brentwood Elementary Grades 2 1 4 3
boy 4 9 White Suburban Brentwood Elementary Popular 3 2 4 1
boy 5 11 Other Suburban Brentwood Elementary Grades 2 1 3 4
boy 5 11 White Suburban Brentwood Elementary Popular 2 1 4 3
boy 5 11 White Suburban Brentwood Elementary Grades 4 1 2 3
boy 5 11 White Suburban Brentwood Elementary Popular 4 3 1 2
boy 5 11 Other Suburban Brentwood Elementary Sports 4 2 1 3
boy 5 11 White Suburban Brentwood Elementary Grades 2 1 3 4
boy 5 11 White Suburban Brentwood Elementary Popular 3 2 1 4
boy 5 10 White Suburban Brentwood Elementary Grades 2 1 3 4
boy 5 11 White Suburban Brentwood Elementary Sports 4 1 2 3
boy 5 11 White Suburban Brentwood Elementary Sports 3 1 2 4
boy 5 10 Other Suburban Brentwood Elementary Popular 3 2 1 4
boy 5 10 White Suburban Brentwood Elementary Sports 4 1 3 2
boy 5 10 White Suburban Brentwood Elementary Sports 4 1 3 2
boy 5 11 White Suburban Brentwood Elementary Grades 2 1 3 4
boy 5 11 White Suburban Brentwood Elementary Grades 1 2 4 3
boy 5 10 White Suburban Brentwood Elementary Grades 2 3 1 4
boy 5 11 White Suburban Brentwood Elementary Grades 2 1 3 4
boy 5 10 White Suburban Brentwood Elementary Grades 2 1 3 4
boy 5 10 White Suburban Brentwood Elementary Popular 4 1 2 3
boy 5 11 Other Suburban Brentwood Elementary Grades 3 1 2 4
boy 5 10 White Suburban Brentwood Elementary Grades 3 4 1 2
boy 5 10 White Suburban Brentwood Elementary Grades 2 1 3 4
boy 5 10 White Suburban Brentwood Elementary Grades 2 1 4 3
boy 5 10 White Suburban Brentwood Elementary Grades 3 1 2 4
boy 5 11 White Suburban Brentwood Elementary Popular 4 2 1 3
boy 5 10 White Suburban Brentwood Elementary Grades 1 3 2 4
boy 5 10 White Suburban Brentwood Elementary Grades 2 1 4 3
boy 5 10 White Suburban Brentwood Elementary Popular 4 2 1 3
girl 5 9 White Suburban Brentwood Elementary Popular 2 3 1 4
girl 5 11 White Suburban Brentwood Elementary Grades 3 2 1 4
girl 5 12 Other Suburban Brentwood Elementary Grades 2 3 1 4
girl 5 10 White Suburban Brentwood Elementary Grades 3 4 1 2
girl 5 11 White Suburban Brentwood Elementary Grades 2 4 1 3
girl 5 11 White Suburban Brentwood Elementary Grades 2 1 4 3
girl 5 10 White Suburban Brentwood Elementary Grades 2 3 1 4
girl 5 10 White Suburban Brentwood Elementary Grades 1 2 3 4
girl 5 12 White Suburban Brentwood Elementary Popular 3 4 1 2
girl 5 11 White Suburban Brentwood Elementary Grades 1 4 2 3
girl 5 11 White Suburban Brentwood Elementary Grades 3 4 1 2
girl 5 10 White Suburban Brentwood Elementary Grades 3 1 2 4
girl 5 10 White Suburban Brentwood Elementary Grades 2 1 4 3
girl 5 10 White Suburban Brentwood Elementary Popular 2 3 1 4
girl 5 10 White Suburban Brentwood Elementary Popular 3 2 1 4
girl 5 10 White Suburban Brentwood Elementary Grades 1 3 2 4
girl 5 11 White Suburban Brentwood Elementary Sports 1 3 2 4
girl 6 11 Other Suburban Brentwood Middle Popular 2 3 1 4
girl 6 11 White Suburban Brentwood Middle Popular 1 3 2 4
girl 6 11 White Suburban Brentwood Middle Popular 1 3 4 2
girl 6 11 White Suburban Brentwood Middle Grades 4 1 2 3
girl 6 11 White Suburban Brentwood Middle Sports 1 2 3 4
girl 6 11 White Suburban Brentwood Middle Grades 3 4 1 2
girl 6 11 White Suburban Brentwood Middle Popular 1 2 3 4
girl 6 11 White Suburban Brentwood Middle Popular 4 2 1 3
girl 6 11 White Suburban Brentwood Middle Popular 4 3 1 2
girl 6 11 White Suburban Brentwood Middle Popular 3 4 1 2
girl 6 12 White Suburban Brentwood Middle Grades 2 3 1 4
girl 6 11 White Suburban Brentwood Middle Grades 4 3 1 2
girl 6 11 White Suburban Brentwood Middle Popular 4 3 1 2
girl 6 11 White Suburban Brentwood Middle Grades 3 2 1 4
girl 6 11 White Suburban Brentwood Middle Grades 4 3 1 2
girl 6 11 White Suburban Brentwood Middle Grades 4 1 2 3
girl 6 11 White Suburban Brentwood Middle Sports 3 1 2 4
girl 6 11 White Suburban Brentwood Middle Grades 4 3 2 1
girl 6 11 White Suburban Brentwood Middle Popular 1 2 3 4
girl 6 12 White Suburban Brentwood Middle Grades 3 1 2 4
girl 6 11 White Suburban Brentwood Middle Popular 4 3 1 2
girl 6 12 White Suburban Brentwood Middle Popular 2 3 1 4
girl 6 11 White Suburban Brentwood Middle Popular 2 1 3 4
girl 6 11 White Suburban Brentwood Middle Grades 2 3 1 4
girl 6 11 White Suburban Brentwood Middle Popular 4 3 1 2
girl 6 11 White Suburban Brentwood Middle Grades 3 2 1 4
girl 6 11 White Suburban Brentwood Middle Grades 4 2 1 3
girl 6 11 White Suburban Brentwood Middle Grades 3 4 1 2
girl 6 11 White Suburban Brentwood Middle Grades 4 3 1 2
girl 6 12 White Suburban Brentwood Middle Sports 4 3 2 1
girl 6 11 White Suburban Brentwood Middle Popular 1 3 2 4
girl 6 11 White Suburban Brentwood Middle Grades 4 2 1 3
girl 6 11 White Suburban Brentwood Middle Grades 4 3 1 2
girl 6 12 White Suburban Brentwood Middle Grades 3 2 1 4
girl 6 12 White Suburban Brentwood Middle Grades 4 2 1 3
girl 6 11 White Suburban Brentwood Middle Grades 4 2 1 3
boy 6 11 White Suburban Brentwood Middle Popular 3 1 2 4
boy 6 12 White Suburban Brentwood Middle Grades 3 1 2 4
boy 6 11 White Suburban Brentwood Middle Popular 3 2 1 4
boy 6 11 White Suburban Brentwood Middle Popular 4 2 1 3
boy 6 12 Other Suburban Brentwood Middle Grades 4 1 2 3
boy 6 12 White Suburban Brentwood Middle Grades 1 3 4 2
boy 6 11 White Suburban Brentwood Middle Popular 3 1 2 4
boy 6 12 White Suburban Brentwood Middle Grades 1 2 3 4
boy 6 12 Other Suburban Brentwood Middle Grades 2 1 3 4
boy 6 12 Other Suburban Brentwood Middle Popular 4 3 1 2
boy 6 12 White Suburban Brentwood Middle Grades 4 1 2 3
boy 6 11 White Suburban Brentwood Middle Sports 3 1 2 4
boy 6 11 White Suburban Brentwood Middle Grades 4 1 2 3
boy 6 11 White Suburban Brentwood Middle Sports 2 1 4 3
boy 6 12 White Suburban Brentwood Middle Grades 2 1 4 3
boy 6 11 White Suburban Brentwood Middle Grades 2 1 4 3
boy 6 11 White Suburban Brentwood Middle Grades 4 1 2 3
boy 6 12 White Suburban Brentwood Middle Grades 4 1 2 3
boy 6 11 White Suburban Brentwood Middle Grades 4 1 2 3
boy 6 11 White Suburban Brentwood Middle Sports 2 3 1 4
boy 6 11 White Suburban Brentwood Middle Popular 3 1 2 4
boy 6 12 White Suburban Brentwood Middle Grades 3 1 2 4
boy 6 12 White Suburban Brentwood Middle Popular 3 1 2 4
boy 6 11 White Suburban Brentwood Middle Grades 3 1 2 4
boy 6 12 White Suburban Brentwood Middle Popular 2 1 4 3
boy 6 11 White Suburban Brentwood Middle Grades 1 2 3 4
boy 6 12 White Suburban Brentwood Middle Grades 2 1 4 3
boy 6 11 White Suburban Brentwood Middle Grades 1 2 3 4
boy 6 12 White Suburban Brentwood Middle Sports 2 1 3 4
boy 6 11 White Suburban Brentwood Middle Sports 2 1 3 4
boy 6 11 White Suburban Brentwood Middle Grades 4 1 3 2
boy 5 11 White Suburban Brentwood Middle Popular 3 2 1 4
boy 6 11 White Suburban Brentwood Middle Grades 3 2 1 4
boy 6 11 White Suburban Brentwood Middle Popular 3 1 4 2
boy 6 11 White Suburban Brentwood Middle Grades 1 2 3 4
boy 6 12 White Suburban Brentwood Middle Sports 2 3 1 4
boy 6 11 White Suburban Brentwood Middle Grades 1 2 3 4
boy 6 12 White Suburban Brentwood Middle Grades 2 1 3 4
boy 6 11 White Suburban Brentwood Middle Grades 4 3 2 1
boy 6 12 White Suburban Brentwood Middle Popular 4 1 2 3
boy 6 12 White Suburban Brentwood Middle Grades 4 1 2 3
boy 6 12 White Suburban Brentwood Middle Grades 4 3 1 2
boy 6 12 White Suburban Brentwood Middle Sports 1 2 3 4
boy 6 11 White Suburban Brentwood Middle Grades 2 1 3 4
boy 6 12 White Suburban Brentwood Middle Sports 3 1 2 4
boy 6 12 White Suburban Brentwood Middle Grades 1 2 3 4
girl 4 9 White Rural Ridge Grades 1 3 2 4
girl 4 9 White Rural Ridge Grades 1 3 2 4
girl 4 9 White Rural Ridge Popular 1 4 3 2
girl 4 9 White Rural Ridge Popular 2 4 1 3
girl 4 9 White Rural Ridge Sports 1 2 3 4
girl 4 9 White Rural Ridge Popular 3 4 1 2
girl 4 9 White Rural Ridge Sports 2 3 1 4
girl 4 9 White Rural Ridge Grades 1 4 2 3
girl 4 9 White Rural Ridge Sports 3 2 1 4
girl 4 9 White Rural Ridge Sports 2 1 3 4
girl 4 9 White Rural Ridge Popular 2 3 1 4
girl 4 9 White Rural Ridge Popular 4 2 1 3
girl 4 10 White Rural Ridge Grades 1 2 3 4
boy 4 9 White Rural Ridge Grades 3 4 2 1
boy 4 10 White Rural Ridge Grades 2 1 3 4
boy 4 9 White Rural Ridge Grades 1 2 3 4
boy 4 9 White Rural Ridge Popular 2 3 1 4
boy 4 10 White Rural Ridge Sports 4 1 2 3
boy 4 9 White Rural Ridge Popular 1 2 4 3
boy 4 9 White Rural Ridge Sports 2 1 4 3
boy 4 9 White Rural Ridge Popular 4 3 1 2
boy 4 9 White Rural Ridge Popular 3 4 1 2
boy 4 9 White Rural Ridge Grades 1 3 2 4
boy 5 10 White Rural Ridge Grades 1 3 2 4
boy 5 10 White Rural Ridge Sports 3 1 2 4
boy 5 10 White Rural Ridge Sports 4 2 1 3
boy 5 11 White Rural Ridge Sports 2 3 4 1
boy 5 10 White Rural Ridge Popular 1 4 3 2
boy 5 11 White Rural Ridge Grades 1 2 4 3
boy 5 11 White Rural Ridge Popular 3 2 1 4
boy 5 10 White Rural Ridge Sports 1 2 4 3
boy 5 10 White Rural Ridge Sports 2 1 3 4
boy 5 10 White Rural Ridge Sports 3 1 2 4
boy 5 11 White Rural Ridge Popular 4 1 2 3
boy 5 10 White Rural Ridge Grades 3 1 2 4
boy 5 10 White Rural Ridge Popular 4 2 1 3
girl 5 10 White Rural Ridge Sports 3 1 2 4
girl 5 10 White Rural Ridge Grades 3 2 1 4
girl 5 10 White Rural Ridge Popular 2 3 1 4
girl 5 10 White Rural Ridge Popular 3 2 1 4
girl 5 11 White Rural Ridge Sports 4 2 1 3
girl 5 10 White Rural Ridge Grades 1 2 4 3
girl 5 11 White Rural Ridge Popular 4 2 1 3
girl 5 11 White Rural Ridge Grades 1 3 4 2
girl 5 10 White Rural Ridge Popular 4 3 1 2
girl 5 10 White Rural Ridge Popular 1 2 3 4
girl 5 11 White Rural Ridge Grades 1 3 2 4
girl 5 10 White Rural Ridge Grades 1 2 3 4
boy 5 12 White Rural Sand Sports 2 1 3 4
boy 5 10 White Rural Sand Popular 4 3 1 2
boy 5 10 White Rural Sand Popular 2 1 3 4
boy 5 10 White Rural Sand Sports 4 1 2 3
boy 5 10 White Rural Sand Sports 2 1 4 3
boy 5 10 White Rural Sand Sports 3 1 4 2
boy 5 11 White Rural Sand Grades 4 2 3 1
boy 5 10 White Rural Sand Grades 2 1 3 4
boy 5 10 White Rural Sand Grades 1 2 4 3
girl 5 10 White Rural Sand Popular 2 3 1 4
girl 5 10 White Rural Sand Popular 3 2 1 4
girl 5 10 White Rural Sand Popular 1 3 2 4
girl 5 11 White Rural Sand Grades 2 4 1 3
girl 5 10 White Rural Sand Grades 1 2 3 4
girl 5 10 White Rural Sand Grades 2 4 3 1
girl 5 10 White Rural Sand Popular 3 2 1 4
girl 5 10 Other Rural Sand Grades 2 4 1 3
boy 4 9 White Rural Sand Grades 3 1 2 4
boy 4 10 White Rural Sand Grades 3 1 4 2
boy 4 10 White Rural Sand Grades 1 3 2 4
girl 4 9 White Rural Sand Grades 2 1 3 4
girl 4 9 White Rural Sand Grades 1 3 2 4
girl 4 9 White Rural Sand Grades 3 4 1 2
girl 4 10 White Rural Sand Popular 2 1 3 4
girl 4 9 White Rural Sand Grades 1 3 2 4
girl 4 9 White Rural Sand Sports 3 2 1 4
girl 4 9 White Rural Sand Sports 3 2 1 4
girl 4 9 White Rural Sand Grades 2 1 3 4
girl 6 12 White Rural Brown Middle Popular 4 2 1 3
girl 6 11 White Rural Brown Middle Popular 3 4 1 2
girl 6 11 White Rural Brown Middle Grades 4 2 1 3
girl 6 11 White Rural Brown Middle Grades 4 2 1 3
girl 6 11 White Rural Brown Middle Grades 1 3 2 4
girl 6 12 White Rural Brown Middle Grades 4 3 1 2
girl 6 12 Other Rural Brown Middle Grades 3 2 1 4
girl 6 11 White Rural Brown Middle Popular 1 2 3 4
girl 6 11 White Rural Brown Middle Sports 4 1 3 2
girl 6 12 White Rural Brown Middle Grades 4 3 1 2
girl 6 11 White Rural Brown Middle Popular 2 1 3 4
girl 6 11 White Rural Brown Middle Popular 3 2 1 4
girl 6 11 Other Rural Brown Middle Grades 1 3 4 2
girl 6 11 White Rural Brown Middle Popular 3 1 2 4
girl 6 11 White Rural Brown Middle Popular 1 2 3 4
girl 6 11 White Rural Brown Middle Popular 4 2 1 3
girl 6 12 White Rural Brown Middle Grades 4 2 1 3
girl 6 11 White Rural Brown Middle Grades 2 3 1 4
girl 6 11 White Rural Brown Middle Grades 2 3 1 4
girl 6 11 White Rural Brown Middle Grades 1 4 2 3
girl 6 11 White Rural Brown Middle Popular 4 2 1 3
girl 6 12 White Rural Brown Middle Grades 3 1 2 4
girl 6 11 White Rural Brown Middle Grades 4 2 1 3
girl 6 12 White Rural Brown Middle Sports 2 1 3 4
girl 6 11 White Rural Brown Middle Sports 2 4 1 3
girl 6 11 White Rural Brown Middle Grades 4 2 1 3
boy 6 12 White Rural Brown Middle Sports 4 3 1 2
boy 6 11 White Rural Brown Middle Sports 3 1 2 4
boy 6 11 White Rural Brown Middle Sports 4 2 1 3
boy 6 12 White Rural Brown Middle Popular 4 2 3 1
boy 6 11 White Rural Brown Middle Sports 2 1 3 4
boy 6 12 White Rural Brown Middle Sports 3 1 2 4
boy 6 11 White Rural Brown Middle Grades 4 1 2 3
boy 6 12 White Rural Brown Middle Grades 4 2 1 3
boy 6 11 White Rural Brown Middle Sports 4 1 2 3
boy 6 12 White Rural Brown Middle Popular 2 3 4 1
boy 6 11 White Rural Brown Middle Grades 3 2 1 4
boy 6 11 White Rural Brown Middle Grades 2 1 3 4
boy 6 12 White Rural Brown Middle Sports 3 1 2 4
boy 6 11 White Rural Brown Middle Grades 3 1 4 2
boy 6 11 White Rural Brown Middle Grades 4 1 2 3
boy 6 12 Other Rural Brown Middle Popular 4 3 2 1
boy 6 12 White Rural Brown Middle Sports 3 1 2 4
boy 6 11 White Rural Brown Middle Grades 1 2 3 4
boy 6 12 White Rural Brown Middle Sports 4 1 2 3
boy 6 11 White Rural Brown Middle Popular 4 2 1 3
boy 6 11 White Rural Brown Middle Grades 4 3 1 2
boy 6 11 White Rural Brown Middle Sports 3 1 4 2
boy 6 11 White Rural Brown Middle Popular 4 2 1 3
boy 6 11 White Rural Brown Middle Sports 3 1 4 2
girl 4 9 Other Urban Main Grades 1 2 3 4
girl 4 9 White Urban Main Popular 4 3 1 2
girl 4 9 White Urban Main Grades 1 3 2 4
girl 4 9 Other Urban Main Sports 4 1 2 3
girl 4 9 White Urban Main Grades 2 1 3 4
girl 4 9 Other Urban Main Grades 2 4 1 3
girl 4 10 White Urban Main Grades 3 2 1 4
girl 4 10 White Urban Main Grades 3 2 1 4
girl 4 9 White Urban Main Grades 1 2 3 4
girl 4 9 White Urban Main Popular 2 1 3 4
girl 4 9 White Urban Main Sports 1 3 2 4
girl 4 9 White Urban Main Grades 1 2 3 4
girl 4 9 White Urban Main Grades 1 2 3 4
girl 4 9 White Urban Main Grades 4 3 1 2
girl 4 9 White Urban Main Grades 1 2 4 3
boy 4 9 White Urban Main Grades 3 1 2 4
boy 4 9 White Urban Main Popular 1 3 2 4
boy 4 9 White Urban Main Grades 3 1 4 2
boy 4 9 White Urban Main Sports 1 2 4 3
boy 4 9 White Urban Main Grades 3 1 2 4
boy 4 9 White Urban Main Sports 2 1 4 3
boy 4 9 White Urban Main Sports 2 3 1 4
boy 4 9 White Urban Main Grades 2 1 4 3
boy 4 9 Other Urban Main Grades 4 1 3 2
boy 4 10 White Urban Main Grades 2 1 4 3
boy 4 9 White Urban Main Grades 2 1 3 4
girl 5 10 White Urban Main Grades 4 2 1 3
girl 5 10 White Urban Main Grades 1 2 3 4
girl 5 11 White Urban Main Grades 2 1 4 3
girl 5 10 White Urban Main Grades 4 3 1 2
girl 5 10 White Urban Main Popular 3 2 1 4
girl 5 10 Other Urban Main Popular 2 4 1 3
girl 5 11 White Urban Main Grades 1 2 3 4
girl 5 10 White Urban Main Grades 1 2 3 4
girl 5 10 White Urban Main Popular 4 1 2 3
girl 5 11 White Urban Main Sports 2 1 4 3
girl 5 10 White Urban Main Grades 1 2 4 3
girl 5 10 White Urban Main Grades 4 3 2 1
girl 5 10 White Urban Main Popular 1 4 2 3
girl 5 10 White Urban Main Grades 4 1 2 3
girl 5 10 White Urban Main Popular 2 3 1 4
girl 5 10 White Urban Main Popular 4 3 2 1
girl 5 10 White Urban Main Popular 2 1 3 4
girl 5 10 White Urban Main Grades 1 2 4 3
girl 5 10 White Urban Main Grades 1 3 2 4
girl 5 10 White Urban Main Grades 2 4 3 1
girl 5 10 White Urban Main Grades 1 2 3 4
boy 5 10 White Urban Main Grades 1 2 3 4
boy 5 11 White Urban Main Sports 3 1 2 4
boy 5 10 Other Urban Main Grades 2 1 4 3
boy 5 11 Other Urban Main Grades 1 4 2 3
boy 5 10 White Urban Main Grades 2 1 4 3
boy 5 10 White Urban Main Grades 1 2 4 3
boy 5 10 White Urban Main Grades 2 1 3 4
boy 5 10 White Urban Main Sports 2 1 3 4
boy 5 11 White Urban Main Grades 2 1 4 3
boy 5 9 Other Urban Main Grades 2 1 3 4
boy 5 10 White Urban Main Grades 3 4 2 1
boy 5 10 Other Urban Main Grades 1 2 3 4
boy 5 10 White Urban Main Grades 2 1 3 4
boy 5 10 White Urban Main Sports 2 1 4 3
boy 5 11 White Urban Main Popular 3 1 2 4
boy 5 11 White Urban Main Grades 1 2 3 4
boy 5 11 White Urban Main Popular 3 1 2 4
boy 5 9 Other Urban Main Grades 3 1 4 2
boy 5 11 White Urban Main Sports 2 1 3 4
boy 5 10 White Urban Main Sports 2 1 3 4
girl 5 10 White Urban Main Grades 3 2 1 4
girl 4 9 White Urban Portage Sports 4 3 1 2
boy 4 9 White Urban Portage Sports 3 2 1 4
boy 4 9 Other Urban Portage Grades 4 3 1 2
boy 4 9 White Urban Portage Grades 1 2 3 4
girl 4 9 White Urban Portage Grades 1 2 3 4
girl 4 10 White Urban Portage Grades 3 1 2 4
girl 4 9 White Urban Portage Grades 1 3 2 4
girl 4 9 Other Urban Portage Popular 2 3 1 4
boy 4 9 White Urban Portage Popular 4 1 2 3
boy 4 9 White Urban Portage Popular 3 1 2 4
boy 4 9 White Urban Portage Grades 1 3 2 4
boy 5 10 White Urban Portage Grades 1 2 4 3
boy 5 11 White Urban Portage Grades 1 3 2 4
boy 5 10 Other Urban Portage Grades 2 1 3 4
boy 5 11 White Urban Portage Popular 3 2 1 4
boy 5 10 White Urban Portage Grades 2 4 1 3
boy 5 10 White Urban Portage Grades 3 1 4 2
boy 5 11 White Urban Portage Grades 1 2 3 4
girl 5 10 White Urban Portage Grades 1 3 2 4
girl 5 10 White Urban Portage Popular 3 2 1 4
girl 5 10 White Urban Portage Grades 1 2 3 4
girl 5 10 White Urban Portage Popular 2 4 1 3
girl 5 10 White Urban Portage Popular 3 1 2 4
girl 5 10 White Urban Portage Grades 1 2 3 4
girl 5 11 White Urban Portage Popular 3 1 2 4
girl 5 10 White Urban Portage Popular 2 3 1 4
girl 5 10 White Urban Portage Grades 3 1 2 4
girl 5 10 White Urban Portage Grades 1 3 2 4
girl 5 10 White Urban Portage Grades 2 1 3 4
boy 5 10 White Urban Portage Sports 3 1 4 2
boy 5 11 White Urban Portage Sports 3 1 2 4
boy 5 10 White Urban Portage Grades 3 2 1 4
boy 5 10 White Urban Portage Sports 3 1 2 4
boy 5 11 White Urban Portage Grades 4 1 3 2
boy 5 10 White Urban Portage Popular 4 3 1 2
girl 5 10 Other Urban Portage Grades 2 1 3 4
girl 5 11 White Urban Portage Popular 2 4 1 3
girl 5 10 White Urban Portage Popular 3 2 1 4
girl 5 11 White Urban Portage Sports 3 2 1 4
girl 5 11 White Urban Portage Popular 2 4 1 3
girl 5 11 Other Urban Portage Grades 2 4 1 3
girl 5 10 White Urban Portage Popular 3 2 1 4
girl 5 10 Other Urban Portage Sports 3 2 1 4
girl 5 11 White Urban Portage Popular 4 3 1 2
girl 5 10 White Urban Portage Popular 3 2 1 4
boy 4 9 White Urban Portage Sports 3 2 4 1
boy 4 9 White Urban Portage Sports 3 2 4 1
boy 4 9 White Urban Portage Grades 4 3 2 1
boy 4 9 White Urban Portage Grades 1 4 3 2
girl 4 9 White Urban Portage Sports 2 4 1 3
girl 4 9 White Urban Portage Grades 2 4 1 3
girl 4 9 White Urban Portage Sports 1 3 4 2
girl 4 9 White Urban Portage Popular 4 3 1 2
girl 4 9 White Urban Portage Grades 3 2 1 4
boy 4 9 White Urban Portage Grades 2 1 4 3
boy 4 9 White Urban Portage Grades 1 2 3 4
boy 4 9 White Urban Portage Popular 3 1 2 4
girl 4 9 White Urban Portage Grades 4 3 2 1
girl 4 9 White Urban Portage Popular 4 2 3 1
girl 4 9 White Urban Portage Grades 3 2 1 4
girl 4 9 White Urban Portage Popular 3 2 1 4
girl 6 11 White Urban Westdale Middle Popular 3 2 1 4
girl 6 11 White Urban Westdale Middle Popular 4 3 2 1
girl 6 11 White Urban Westdale Middle Popular 3 1 2 4
girl 6 11 White Urban Westdale Middle Popular 4 2 1 3
girl 6 11 Other Urban Westdale Middle Grades 4 2 1 3
girl 6 11 White Urban Westdale Middle Popular 4 2 1 3
girl 6 11 White Urban Westdale Middle Popular 4 1 2 3
girl 6 11 White Urban Westdale Middle Grades 3 2 1 4
girl 6 11 White Urban Westdale Middle Grades 2 3 1 4
girl 6 11 White Urban Westdale Middle Grades 4 3 1 2
girl 6 11 White Urban Westdale Middle Grades 3 2 1 4
girl 6 11 White Urban Westdale Middle Popular 3 2 1 4
girl 6 11 White Urban Westdale Middle Grades 4 2 1 3
girl 6 11 White Urban Westdale Middle Popular 3 1 2 4
girl 6 12 Other Urban Westdale Middle Popular 2 4 3 1
girl 6 11 White Urban Westdale Middle Grades 4 3 1 2
girl 6 11 White Urban Westdale Middle Grades 2 3 1 4
girl 6 11 White Urban Westdale Middle Popular 3 2 1 4
girl 6 11 Other Urban Westdale Middle Popular 2 3 4 1
girl 6 12 White Urban Westdale Middle Grades 2 1 3 4
girl 6 11 White Urban Westdale Middle Grades 4 2 1 3
girl 5 11 White Urban Westdale Middle Grades 3 2 1 4
girl 6 11 White Urban Westdale Middle Grades 2 3 1 4
girl 6 11 Other Urban Westdale Middle Sports 4 1 2 3
girl 6 11 White Urban Westdale Middle Grades 4 3 1 2
girl 6 11 White Urban Westdale Middle Grades 3 4 1 2
girl 6 11 White Urban Westdale Middle Popular 4 2 1 3
girl 6 11 White Urban Westdale Middle Popular 3 4 1 2
girl 6 11 White Urban Westdale Middle Grades 3 4 1 2
girl 6 11 White Urban Westdale Middle Grades 3 2 1 4
girl 6 11 Other Urban Westdale Middle Grades 3 2 1 4
girl 6 11 White Urban Westdale Middle Popular 4 3 1 2
girl 6 11 White Urban Westdale Middle Sports 3 2 1 4
girl 6 11 White Urban Westdale Middle Grades 4 2 1 3
boy 6 12 White Urban Westdale Middle Grades 3 1 2 4
boy 6 11 Other Urban Westdale Middle Sports 3 2 1 4
boy 6 11 White Urban Westdale Middle Grades 3 1 2 4
boy 6 11 White Urban Westdale Middle Grades 1 2 3 4
boy 6 12 White Urban Westdale Middle Grades 3 1 2 4
boy 6 11 White Urban Westdale Middle Grades 2 1 3 4
boy 6 11 White Urban Westdale Middle Popular 3 1 2 4
boy 6 12 White Urban Westdale Middle Grades 3 1 2 4
boy 6 11 White Urban Westdale Middle Grades 4 2 1 3
boy 6 11 White Urban Westdale Middle Grades 3 2 1 4
boy 6 11 White Urban Westdale Middle Grades 4 1 2 3
boy 6 11 White Urban Westdale Middle Sports 4 1 2 3
boy 6 11 White Urban Westdale Middle Grades 4 2 1 3
boy 6 11 White Urban Westdale Middle Popular 4 1 3 2
boy 6 11 White Urban Westdale Middle Popular 4 1 2 3
RwebDistribution/CGIFiles/DataSets/PopularKids.desc 100644 1051 63 3463 6673263746 22132 0 ustar deleeuw faculty
Dataset Description:
Subjects were students in grades 4-6 from
three school districts in Ingham and Clinton Counties, Michigan. The researchers
stratified their sample, selecting students from urban,
suburban, and rural school districts with approximately 1/3 of their
sample coming from each district. Students indicated whether good
grades, athletic ability, or popularity was most important to
them. They also ranked four factors: grades, sports, looks, and money,
in order of their importance for popularity. The questionnaire also
asked for gender, grade level, and other demographic information.
There are 473 kids in the survey.
Variable Descriptions:
Gender: Boy or girl
Grade: 4, 5 or 6.
Age: Age in years
Race: White, Other
Location: Rural, Suburban, or Urban school district
Goals: Student's choice in the personal goals question
where options were 1 = Make Good Grades, 2 = Be Popular, 3 = Be
Good in Sports
Grade: Rank of "make good grades" (1=most
important for popularity, 4=least important)
Sports: Rank of "being good at sports" (1=most important for popularit
y, 4=least
important)
Looks: Rank of "being handsome or pretty" (1=most
important for popularity, 4=least important)
Money: Rank of
"having lots of money" (1=most important for popularity, 4=least
important)
SOURCE:
Chase, M. A., and Dummer, G. M. (1992), "The Role of Sports as a Social Determin
ant for Children," Research Quarterly for Exercise and Sport, 63, 418-
424.
RwebDistribution/CGIFiles/DataSets/PopularKids.input 100644 1051 63 752 6673263746 22331 0 ustar deleeuw faculty variables:
Gender, Grade, Age, Race, Location, School, Goals, Grades, Sports, Looks, Money
&
code:
PopularKids <- read.table('DataSets/PopularKids.data', header=T, sep="\t")
attach(PopularKids)
&
description:
Information about elementary school children including; Gender, Grade, Age,
Race, and various attributes that the children rank according to how they think
the attribute effects a persons popularity. Attributes are: Grades, Sports, Looks, Money.
A nice data set for two way tables. RwebDistribution/CGIFiles/DataSets/trees.desc 100644 1051 63 561 6673263746 20773 0 ustar deleeuw faculty This data set provides measurements of the girth, height and volume
of timber in 31 felled black cherry trees. Note that girth is the
diameter of the tree at 4 ft 6 in above the ground.
Variables:
Name Type Description
Girth Continuous Diameter of tree trunk 4'6" above the ground
Height Continuous Height of tree
Volume Continuous Volume of the trunk of the tree
RwebDistribution/CGIFiles/DataSets/trees.input 100644 1051 63 466 6673263746 21220 0 ustar deleeuw faculty variables:
Girth, Height, Volume
&
description:
This data set provides measurements of the girth, height and volume
of timber in 31 felled black cherry trees. Note that girth is the
diameter of the tree at 4 ft 6 in above the ground. This data set
can be used for regression
&
code:
data(trees)
attach(trees) RwebDistribution/CGIFiles/DataSets/warpbreaks.desc 100644 1051 63 756 6673263746 22020 0 ustar deleeuw faculty The Number of Breaks in Yarn during Weaving
This data set gives the number of warp breaks
per loom, where a loom corresponds to a fixed
length of yarn.
VARIABLES:
Name Type Description
breaks discrete The number of breaks in the yarn
(0, 1, 2, ...)
wool factor The type of wool (A, B)
tension factor The level of tension on the wool
(L, M, H)
REFERENCE:
Tukey, J. W. (1977). Exploratory Data Analysis. Addison-Wesley.
McNeil, D. (1977). Interactive Data Analysis. Wiley.
RwebDistribution/CGIFiles/DataSets/warpbreaks.input 100644 1051 63 337 6673263746 22234 0 ustar deleeuw faculty variables:
breaks, wool, tension
&
code:
data(warpbreaks)
attach(warpbreaks)
&
description:
Number of breaks in yarn while weaving with information
about type of wool and tension on the yarn. Good for
One and Two-Way ANOVA. RwebDistribution/CGIFiles/debug.pl 100644 1051 63 1320 6673263746 16736 0 ustar deleeuw faculty #!/usr/local/bin/perl
# perl_form - a simple illustration of forms and Perl CGI
require "globalVariables";
require "Rweb.pm";
print "Content-type: text/html\n\n";
&ReadParse;
print "The Response\n
The Response
\n\n";
print "Here is the form data:
";
foreach $key (keys %in) {
print "
$key: $in{$key}";
}
print "
\n";
print "and here are all the environment variables:\n
";
foreach $key (keys %ENV) {
print "
$key: $ENV{$key}";
}
print "\n
\n";
print "here is the content string: \n $in";
RwebDistribution/CGIFiles/globalVariables 100644 1051 63 1717 6673263746 20341 0 ustar deleeuw faculty # use Sys::Hostname;
# $HOSTNAME = hostname();
#$HOSTNAME = "NULL" ; # just for debuging the code without connecting
# $HOSTNAME = "207.0.103.64";
$HOSTNAME = "www.math.montana.edu";
$CGIDIR = "jeff-bin/Distribution";
# $CGIDIR = "jeff-bin";
$SERVER = $HOSTNAME;
# $RWEBDIR = "RwebDistribution/WebPages";
$RWEBDIR = "Rweb";
# Do you want usage logged?
$LOGFILE = "True";
# Where are the perl Web modules?
$LOCALPERLLIB = "/export/faculty/umsfjban/cgi-bin/perl/";
# Where is the R executable?
$RDIR = "/opt/local/R/bin/R";
#$RDIR = "/opt/local/bin/Splus";
#$RDIR = "/opt/local/maple/bin/maple";
# Where is the Rweb .Rprofile file?
$RPROFILEDIR = "/export/faculty/umsfjban/cgi-bin";
# Where are the builtin Rweb Datasets
$RWEBDATA = "/export/faculty/umsfjban/cgi-bin/Distribution/DataSets";
# Where is the pstoimg script
$PSTOIMG = "/export/faculty/umsfjban/bin/pstoimg";
# Where do we store the temporary files for input, output, data ... ?
$TMPDIR = "/tmp";
RwebDistribution/CGIFiles/nph-imageDump.pl 100644 1051 63 1745 6673263746 20356 0 ustar deleeuw faculty #!/usr/local/bin/perl
### A perl script to dump an image into an html page when called with an image request
### of the form
### The after returning the header and image information, the script deletes the file.
### You have to make sure the Web user has persmission to delete files
### Generally the user is nobody and the files that this script works on are in
### a temporary directory (such as /tmp) and were created by nobody.
$filename = $ENV{'QUERY_STRING'};
($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $rest) = stat $filename;
print << "ending_print_tag";
HTTP/1.1 200 OK
Date: Tue, 13 Jan 1998 21:20:06 GMT
Server: Apache/1.2b6
Connection: close
Content-Type: image/gif
Last-Modified: Tue, 25 Nov 1997 21:50:27 GMT
ETag: "132b73-67a-347b4823"
Content-Length: $size
Accept-Ranges: bytes
ending_print_tag
open(gifFile, $filename);
while (read gifFile, $buf, $size){
print $buf;
}
close(gifFile);
unlink ($filename);
RwebDistribution/CGIFiles/Rweb.cgi 100644 1051 63 3602 6673263746 16703 0 ustar deleeuw faculty #!/usr/local/bin/perl
require "globalVariables";
require "Rweb.pm";
$identifier = $$;
&createTempFiles; # For data, output, ...
$time = time();
# Get the forms data
&ReadParse;
$Rcommands = $in{'comments'};
# Setting up the returned web page
print "Content-type: text/html\n\n";
print(" \n");
print "Results from Rweb
Results from Rweb
";
#====================== Bringing in an External Data Set ==============
if ($in{'Data'}){
$in{'dataname'} = "URLdata";
$dataInput = bringInData (\%in);
if ($dataInput){
&inputStuff($dataInput);
}
else {
exit();
}
}
#====================== End of External Data Set Input ==============
# Maintain a log file to keep track of use
if ( $LOGFILE ) {
open (logFile, ">> log.Rweb");
print logFile "Host:$ENV{'REMOTE_HOST'}%Address:$ENV{'REMOTE_ADDR'}%Browser:$ENV{'HTTP_USER_AGENT'}%Time:$time\n";
close(logFile);
}
# Checking for security problems
&Security;
################################################################
################################################################
# writing the R commands out to a file
open(OUTPUTFILE, "> $FCode");
print OUTPUTFILE ("postscript(file= \"$FOutputPS\", height = 8, width = 8)\n");
print OUTPUTFILE ("$input{'code'} \n"); # code to load and setup data
# This writes out the commands from the text field
print OUTPUTFILE ("$Rcommands");
print OUTPUTFILE ("\n");
close(OUTPUTFILE);
# Now run R in batch mode using the saved commands as the input.
# Output goes into another file that is then read back in and displayed,
# it would be better to do this without the output file but I can't get
# the output to sinc up with the rest of the code ...
&runR;
&printResults;
# Process the postscript file, create gif files and write the necessary code
# into a new Rgif* html file ... this all happens in the $TMPDIR directory
&processPostscript;
&RwebExit;
RwebDistribution/CGIFiles/Rweb.pm 100644 1051 63 25011 6673263746 16573 0 ustar deleeuw faculty #!/usr/local/bin/perl -w
## This file contains subroutines that are used in the Rweb statistical
## analysis package. It should be available in the main Rweb script
## directory.
########################################################################
### ReadParse
### Reads and parses the values returned by a Web browser when calling
### a cgi script ... Everything is put into the %in hash
########################################################################
# Adapted from cgi-lib.pl by S.E.Brenner@bioc.cam.ac.uk
# Copyright 1994 Steven E. Brenner
# modified by Jeff Banfield 12/18/97
sub ReadParse {
local (*in) = @_ if @_;
local ($i, $key, $val);
if ( $ENV{'REQUEST_METHOD'} eq "GET" ) {
$in = $ENV{'QUERY_STRING'};
} elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
read(STDIN,$in,$ENV{'CONTENT_LENGTH'});
} else {
# Added for command line debugging
# Supply name/value form data as a command line argument
# Format: name1=value1\&name2=value2\&...
# (need to escape & for shell)
# Find the first argument that's not a switch (-)
$in = ( grep( !/^-/, @ARGV )) [0];
$in =~ s/\\&/&/g;
}
@in = split(/&/,$in);
foreach $i (0 .. $#in) {
# Convert plus's to spaces
$in[$i] =~ s/\+/ /g;
# Split into key and value.
($key, $val) = split(/=/,$in[$i],2); # splits on the first =.
# Remove the carriage returns from Netscape ... JDB 12/18/97
$val =~ s/%0D//ge;
# Convert %XX from hex numbers to alphanumeric
$key =~ s/%(..)/pack("c",hex($1))/ge;
$val =~ s/%(..)/pack("c",hex($1))/ge;
# Associate key and value. \0 is the multiple separator
$in{$key} .= ", " if (defined($in{$key}));
$in{$key} .= $val;
}
return length($in);
}
###############################################################
## inputStuff
## Get the data file and input the relevant information:
## variables .... the variable names
## code ... the R code necessary to load and set up the variables
## description ... a description of the data set
## All of this is stored in the %input hash
###############################################################
sub inputStuff {
## This test is so we can give the subroutine a filename as an argument
## or, if we don't, just let it find the file name in the %in hash
if (@_[0]) {
$dataname = @_[0];
}
else{
$dataname = $in{'datainputfile'}; # This may be a temporary file!
}
open(inputFile, "$dataname");
@fileContents = ;
close(inputFile);
# convert to scalar so we can do lots of stuff with it ...
foreach $line (@fileContents){
$fileContents .= $line;
}
# strip returns after & and : ... this way the input file can be more readable
$fileContents =~ s/&\n/&/g;
$fileContents =~ s/:\n/:/g;
@input = split(/&/, $fileContents);
# Split into key and value.
foreach $i (0 .. $#input) {
($key, $value) = split(/:/,$input[$i],2); # splits on the first :
$input{$key} = $value;
}
return $input{'description'}; # only used in the buildModule.cgi file
}
###############################################################
## Security
## remove several system calls from the input ...
## this could be a security problem
###############################################################
sub Security {
if ($Rcommands =~ /system\s*\(.*?\)/ ||
$Rcommands =~ /-\s*system/ ||
$Rcommands =~ /_\s*system/){
print "Sorry, you may not use the system function\n";
die;
}
if ($Rcommands =~ /scan\s*\(.*?\)/ ||
$Rcommands =~ /-\s*scan/ ||
$Rcommands =~ /_\s*scan/){
print "Sorry, you may not use the scan function\n";
die;
}
if ($Rcommands =~ /read\.table\s*\(.*?\)/ ||
$Rcommands =~ /-\s*read\.table/ ||
$Rcommands =~ /_\s*read\.table/){
print "Sorry, you may not use the read.table function\n";
die;
}
if ($Rcommands =~ /count\.fields\s*\(.*?\)/ ||
$Rcommands =~ /-\s*count\.fields/ ||
$Rcommands =~ /_\s*count\.fields/){
print "Sorry, you may not use the count.field function\n";
die;
}
if ($Rcommands =~ /write\s*\(.*?\)/ ||
$Rcommands =~ /-\s*write/ ||
$Rcommands =~ /_\s*write/){
print "Sorry, you may not use the write function\n";
die;
}
if ($Rcommands =~ /sink\s*\(.*?\)/ ||
$Rcommands =~ /-\s*sink/ ||
$Rcommands =~ /_\s*sink/){
print "Sorry, you may not use the sink function\n";
die;
}
if ($Rcommands =~ /call\s*\(.*?\)/ ||
$Rcommands =~ /-\s*call/ ||
$Rcommands =~ /_\s*call/){
print "Sorry, you may not use the call function\n";
die;
}
if ($Rcommands =~ /eval\s*\(.*?\)/ ||
$Rcommands =~ /-\s*eval/ ||
$Rcommands =~ /_\s*eval/){
print "Sorry, you may not use the eval function\n";
die;
}if ($Rcommands =~ /assign\s*\(.*?\)/ ||
$Rcommands =~ /-\s*assign/ ||
$Rcommands =~ /_\s*assign/){
print "Sorry, you may not use the assign function\n";
die;
}
# $Rcommands =~ s/scan\(.*?\)/You may not use scan calls/g;
# $Rcommands =~ s/read\.table\(.*?\)/You may not use read.table calls/g;
# $Rcommands =~ s/count\.fields\(.*?\)/You may not use count.fields calls/g;
# $Rcommands =~ s/write\(.*?\)/You may not use write calls/g;
# $Rcommands =~ s/sink\(.*?\)/You may not use sink calls/g;
}
###############################################################
## bringInData
## Checks to see if there is URL or User supplied data then
## creates the necessary data files and R code to read it in
###############################################################
sub bringInData {
# dataname will be URLdata if you have a URL
# $in{'Data'} will contain the URL
# dataname will be Userdata if you have a user supplied dataset
# $in{'UserSuppliedData'} will contain the dataset
# $in will contain the name of the %in hash from the calling script
my $in = @_;
my $dataname = $in{'dataname'};
if (($dataname eq "URLdata") || ($dataname eq "Userdata")) {
$dataFile = $FTempData;
$dataInput = $FTempInput;
if ($dataname eq "URLdata") {
use lib "$LOCALPERLLIB";
use LWP::Simple;
$dataURL = $in{'Data'};
if (head($dataURL) ){
getstore ($dataURL, $dataFile); # download the data
}
else {
print "
Something wrong with data entry
\n";
print "There was and error trying to read $dataURL \n";
print "Please make sure the URL is correct.";
return(0);
}
}
if ($dataname eq "Userdata") {
open(OUTFILE, "> $dataFile");
print OUTFILE "$in{'UserSuppliedData'}";
close(OUTFILE);
}
# create the input file so we don't have to modify the rest of the program
open(INFILE, $dataFile);
$line = || die "couldn't open the file"; # Read the variable names
close(INFILE);
$line =~ s/\s+/, /g; # insert commas
$line =~ s/, $//; # remove the last comma
# write variable names and code to input file
open(OUTFILE, "> $dataInput");
print OUTFILE "variables:\n$line\n&\ncode:\n";
print OUTFILE "X <- read.table(\"$dataFile\", header=T)\n";
print OUTFILE "attach(X)\n";
print OUTFILE "names(X)\n \n";
close(OUTFILE);
}
else {
$dataInput = "$RWEBDATA/$dataname.input";
}
return $dataInput;
}
###############################################################
## runR
## This is just the command to run R in batch mode in the appropriate
## directory and with the correct input and output files.
###############################################################
sub runR {
system("cd $RPROFILEDIR; $RDIR --no-save < $FCode > $FOutputTxt");
}
###############################################################
## RwebExit
## Be nice and clean up all the temporary files
###############################################################
sub RwebExit {
system("rm $FWarnings");
system("rm $FOutputPS");
system("rm $FCode");
system("rm $FOutputTxt");
system("rm $FOutputSink");
system("rm $FTempData"); # Created in the bringInData subroutine
system("rm $FTempInput");
}
###############################################################
## createTempFiles
## Make all of the temporary files for storing code, data, ...
###############################################################
sub createTempFiles {
$FWarnings = "$TMPDIR/Rwarning.$identifier.txt";
$FOutputPS = "$TMPDIR/Rout.$identifier.ps";
$FOutputPSName = "Rout.$identifier.ps";
$FCode = "$TMPDIR/Rcode.$identifier.txt";
$FOutputTxt = "$TMPDIR/Rout.$identifier.txt";
$FOutputSink = "$TMPDIR/Rout.$identifier.sink";
$FTempData = "$TMPDIR/Rdata.$identifier.data";
$FTempInput = "$TMPDIR/Rdata.$identifier.input";
$FIdentifier = $identifier; # This is needed for some of the postscript conversions
}
###############################################################
## ps2gif
## Convert the postscript file to a series of gif files
###############################################################
sub ps2gif {
chdir($TMPDIR);
system("$PSTOIMG -g -m -flip r270 -transparent $FOutputPSName > $FWarnings");
}
###############################################################
## processPostscript
## Process the postscript file, create gif files and write the necessary code
## into a new Rgif* html file ... this all happens in the $TMPDIR directory
###############################################################
sub processPostscript{
# Convert the postscript files to gif format
&ps2gif;
# what gif files do we have?
@gifFiles = glob("Rout$FIdentifier*.gif");
# Check to see if there are any images
if (defined($gifFiles[0])){
# Dump the image files
# This uses the nph-imageDump.pl script that deletes the image files after loading
print "
Images
";
foreach $name (@gifFiles){
print ("\n");
print ("");
}
print "";
}
}
###############################################################
## printResults
## Just opens the output file and prints the results to standard output with
## carriage returns.
###############################################################
sub printResults {
select(STDOUT);
print("
\n");
}
# you need this last "1" so the file returns true!
1
RwebDistribution/CGIFiles/RwebJavaScript.cgi 100644 1051 63 14625 6673263746 20721 0 ustar deleeuw faculty #!/usr/local/bin/perl -w
require "globalVariables";
require "Rweb.pm";
$identifier = $$;
&createTempFiles; # For data, output, ...
$time = time();
# Get the forms data
&ReadParse;
$Rcommands = $in{'comments'};
#====================== Bringing in an External Data Set ==============
if ($in{'Data'}){
$in{'dataname'} = "URLdata";
$dataInput = bringInData (\%in);
&inputStuff($dataInput);
}
#====================== End of External Data Set Input ==============
# Maintain a log file to keep track of use
if ( $LOGFILE ) {
open (logFile, ">> log.RwebJavaScript");
print logFile "Host:$ENV{'REMOTE_HOST'}%Address:$ENV{'REMOTE_ADDR'}%Browser:$ENV{'HTTP_USER_AGENT'}%Time:$time\n";
close(logFile);
}
# Checking for security problems
&Security;
# Setting up the returned web page
print "Content-type: text/html\n\n";
print(" \n");
################################################################
################################################################
# writing the R commands out to a file
open(OUTPUTFILE, "> /tmp/Rcode.$identifier.txt");
print OUTPUTFILE ("postscript(file= \"/tmp/Rout.$identifier.ps\", height = 5, width = 6)\n");
print OUTPUTFILE ("$input{'code'} \n"); # code to load and setup data
$sinkFile = "/tmp/Rout.$identifier.sink";
print OUTPUTFILE "sink(\"$sinkFile\") \n";
# This writes out the commands from the text field
print OUTPUTFILE ("$Rcommands ");
print OUTPUTFILE ("\n");
close(OUTPUTFILE);
# Now run R in batch mode using the saved commands as the input.
# Output goes into the sink file
&runR;
#======================== Rebuilding the Code window ===================
print << "ending_print_tag";
Rweb Code Page
ending_print_tag
#==================== End of rebuilding the Code Window =================
#==================== Build the Debug Window =================
print << "ending_print_tag";
ending_print_tag
#==================== End of building the Debug Window =================
## convert the postscript images to gif format
&ps2gif;
### =====================Writing out the gif files ===========================
# what gif files do we have?
@gifFiles = glob("Rout$identifier*.gif");
# Check to see if there are any images
if (defined($gifFiles[0])){
## ==== The javascript functions to put images in popup window ========
print << "ending_print_tag";
ending_print_tag
}
##==========================End of JavaScript ======================
##==========================End of Gif Files ======================
### =====================Writing out the Sink files ===========================
## Create popup window and write temp file there
## ==== The javascript functions to put Text output into a popup window ========
print << "ending_print_tag";
ending_print_tag
##==========================End of JavaScript ======================
print " ";
&RwebExit;
RwebDistribution/HTMLFiles/ 40755 1051 63 0 6673263750 15357 5 ustar deleeuw faculty RwebDistribution/HTMLFiles/Demo/ 40755 1051 63 0 6673263747 16251 5 ustar deleeuw faculty RwebDistribution/HTMLFiles/Demo/model1.gif 100644 1051 63 1314 6673263747 20215 0 ustar deleeuw faculty GIF89a &