Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c6e5de0
Showing
66 changed files
with
6,143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Package: ProfessR | ||
Type: Package | ||
Title: Grades Setting and Exam Maker | ||
Version: 1.0 | ||
Date: 2007-11-02 | ||
Author: Jonathan M. Lees | ||
Maintainer: Jonathan M. Lees<jonathan.lees@unc.edu> | ||
Description: Programs to determine student grades and create | ||
examinations from Question banks. Programs will create numerous | ||
multiple choice exams, randomly shuffled, for different versions of same question list. | ||
License: GPL | ||
Packaged: Sun Nov 4 12:00:55 2007; lees |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
`Get.testbank` <- | ||
function(fn) | ||
{ | ||
|
||
ALLQ = scan(file=fn, what="", sep="\n") | ||
|
||
q1 = grep("QUESTION:", ALLQ) | ||
|
||
|
||
Qbank = list() | ||
|
||
for(i in 1:length(q1)) | ||
{ | ||
i1 = q1[i] | ||
if(i<length(q1)) | ||
{ i2 = q1[i+1]-1 } else { i2 = length(ALLQ) } | ||
|
||
|
||
## print(paste(sep=" ", "#####", i, i1, i2)) | ||
## print(ALLQ[i1:i2]) | ||
|
||
quest = substring(ALLQ[i1], 11, nchar(ALLQ[i1])) | ||
|
||
|
||
ans1 = ALLQ[(i1+1):i2] | ||
grfig = grep("FIG:", ans1) | ||
if(length(grfig)>=1) | ||
{ | ||
fig1 = ans1[grfig] | ||
ufig = unlist(strsplit(fig1, split=" ")) | ||
|
||
figname = ufig[2] | ||
figtag = ufig[3] | ||
fignewt = list(fn=figname, tag =figtag) | ||
ans1 = ans1[-grfig] | ||
|
||
} | ||
else | ||
{ | ||
fignewt = NULL | ||
} | ||
|
||
a1 = grep("ANSWER:", ans1) | ||
fa1 = ans1[a1] | ||
a2 = substring(fa1, 9, nchar(fa1)) | ||
ans1[a1] = a2 | ||
|
||
Qbank[[i]] = list(Q=quest, A=ans1, a=fa1, numANS=a1, FIG=fignewt) | ||
|
||
} | ||
|
||
return(Qbank) | ||
|
||
|
||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
`LETGRADE` <- | ||
function(g) | ||
{ | ||
|
||
lett = rep("I", length=length(g)) | ||
|
||
SCRS = seq(from=100, by=(-4), length=13) | ||
LETS = c("A+", "A", "A-", "B+", "B", "B-", "C+", "C", "C-", "D+", "D", "D-", "E", "E") | ||
SCRS[1] = 100.1 | ||
SCRS[length(SCRS)+1] = 0 | ||
|
||
for(i in 2:length(SCRS)) | ||
{ | ||
lett[g>=SCRS[i] & g<SCRS[i-1] ] = LETS[i] | ||
|
||
} | ||
|
||
|
||
return(lett) | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
`do.grades` <- | ||
function(ggrades, divs=NULL, cut=0, tit="Exam Grades") | ||
{ | ||
if(missing(divs)) { divs=NULL } | ||
if(missing(cut)) { cut=NULL } | ||
if(missing(tit)) { tit = "Exam Grades" } | ||
|
||
|
||
if(!is.null(cut)) | ||
{ | ||
agrades = ggrades[ggrades>cut] | ||
|
||
} | ||
else | ||
{ | ||
|
||
agrades = ggrades | ||
|
||
} | ||
|
||
BIGN = length(ggrades) | ||
|
||
HA = hist(agrades, breaks=BIGN/3, main=tit, xlab="Scores") | ||
m = mean(agrades) | ||
s = sqrt(var(agrades)) | ||
|
||
B = boxplot(agrades, plot = FALSE) | ||
Bdivs = c(min(agrades), B$stats[1:4] + diff(B$stats)/2, max(agrades) ) | ||
|
||
abline(v=c( m-2*s,m-s, m, m+s, m+2*s), lty=2, col=rgb(1, .7, .7) ) | ||
mtext(text="mean", side=3, at=m, line=0) | ||
|
||
abline(v=Bdivs, lty=2, col=rgb(.1, .7, .7) ) | ||
|
||
u = par("usr") | ||
### print(u) | ||
if(is.null(divs)) | ||
{ | ||
text( c(20, (m-2*s+m-s)/2,(m-s+ m)/2, (m+m+s)/2, (m+s+m+2*s)/2 ), rep(u[4], 5), | ||
labels=c("E", "D", "C", "B", "A"), pos=1 , col=rgb(1, .7, .7) ) | ||
} | ||
box() | ||
if(is.null(divs)) | ||
{ | ||
mtext(text="Click 4 divisions from LOW to HIGH", side=3, at = u[1], line=2, adj=0) | ||
K = locator(type='p', col=4, n=4) | ||
abline(v=K$x, col=4) | ||
divs = c(min(ggrades), K$x, max(ggrades)) | ||
} | ||
|
||
abline(v=divs[2:(length(divs)-1)], col=rgb(0,0,1) ) | ||
|
||
ddivs = diff(divs) | ||
xgrad = divs[1:(length(divs)-1)] + ddivs/2 | ||
|
||
|
||
xmin = HA$breaks[1]+(divs[2]-HA$breaks[1])/2 | ||
xgrad[1]= xmin | ||
text(xgrad , rep(u[4], 5), labels=c("E", "D", "C", "B", "A"), pos=1 ) | ||
|
||
|
||
|
||
|
||
##### print(divs) | ||
divs = sort(divs) | ||
|
||
cat("Grade divisions:", sep="\n") | ||
cat(divs, sep="\n") | ||
|
||
##### divisions are determined, now allocate grades. | ||
### this can be run independent of the divs determination | ||
|
||
KAPPA = getlet(ggrades, divs) | ||
###ggrades, lett=letts, scor=scores, divs=divs, LETS=LETS, SCRS=SCRS | ||
LETS = KAPPA$LETS | ||
letts = KAPPA$lett | ||
scores = KAPPA$scor | ||
SCRS = KAPPA$SCRS | ||
cat("Letter Grade Distribution:", sep="\n") | ||
for(i in 1:length(LETS)) | ||
{ | ||
cat(paste(sep=' ', i, LETS[i], length(letts[letts==LETS[i]])), sep="\n") | ||
} | ||
|
||
cat("Numeric Grade Distribution:", sep="\n") | ||
for(i in 1:length(SCRS)) | ||
{ | ||
cat(paste(sep=' ', i, SCRS[i], length(scores[scores==SCRS[i]])), sep="\n") | ||
} | ||
print(paste(sep=' ', "Mean Score=",mean(scores))) | ||
|
||
|
||
return(list(grades=ggrades, lett=letts, scor=scores, divs=divs, LETS=LETS, SCRS=SCRS, hist=HA)) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
`getlet` <- | ||
function(ggrades, divs) | ||
{ | ||
M = length(divs) | ||
N = M | ||
AP = ggrades>=divs[N]-(divs[N]-divs[N-1])/3 | ||
A = ggrades>= (divs[N]-2*(divs[N]-divs[N-1])/3)& ggrades<divs[N]-(divs[N]-divs[N-1])/3 | ||
AM = ggrades>= (divs[N-1])& ggrades<divs[N]-2*(divs[N]-divs[N-1])/3 | ||
|
||
N = M-1 | ||
BP = ggrades>=divs[N]-(divs[N]-divs[N-1])/3 & ggrades<divs[N] | ||
B = ggrades>= (divs[N]-2*(divs[N]-divs[N-1])/3) & ggrades<divs[N]-(divs[N]-divs[N-1])/3 | ||
BM = ggrades>= (divs[N-1])& ggrades<divs[N]-2*(divs[N]-divs[N-1])/3 | ||
|
||
N = M-2 | ||
CP = ggrades>=divs[N]-(divs[N]-divs[N-1])/3 & ggrades<divs[N] | ||
C = ggrades>= (divs[N]-2*(divs[N]-divs[N-1])/3)& ggrades<divs[N]-(divs[N]-divs[N-1])/3 | ||
CM = ggrades>= (divs[N-1])& ggrades<divs[N]-2*(divs[N]-divs[N-1])/3 | ||
|
||
N = M-3 | ||
DP = ggrades>=divs[N]-(divs[N]-divs[N-1])/3 & ggrades<divs[N] | ||
D = ggrades>= (divs[N]-2*(divs[N]-divs[N-1])/3)& ggrades<divs[N]-(divs[N]-divs[N-1])/3 | ||
DM = ggrades>= (divs[N-1])& ggrades<divs[N]-2*(divs[N]-divs[N-1])/3 | ||
|
||
N = M-4 | ||
E = ggrades>=divs[N-1]&ggrades<divs[N] | ||
|
||
letts = rep("E", length(ggrades)) | ||
scores = rep(0, length(ggrades)) | ||
|
||
SCRS = seq(from=100, by=(-4), length=13) | ||
LETS = c("A+", "A", "A-", "B+", "B", "B-", "C+", "C", "C-", "D+", "D", "D-", "E") | ||
|
||
scores[AP] = SCRS[1] | ||
scores[A] = SCRS[2] | ||
scores[AM] = SCRS[3] | ||
|
||
scores[BP] = SCRS[4] | ||
scores[B] = SCRS[5] | ||
scores[BM] = SCRS[6] | ||
|
||
scores[CP] = SCRS[7] | ||
scores[C] = SCRS[8] | ||
scores[CM] = SCRS[9] | ||
|
||
scores[DP] = SCRS[10] | ||
scores[D] = SCRS[11] | ||
scores[DM] = SCRS[12] | ||
|
||
scores[E] = SCRS[13]-SCRS[13]*(divs[2]-ggrades[E])/divs[2] | ||
|
||
letts[AP] = LETS[1] | ||
letts[A] = LETS[2] | ||
letts[AM] = LETS[3] | ||
|
||
letts[BP] = LETS[4] | ||
letts[B] = LETS[5] | ||
letts[BM] = LETS[6] | ||
|
||
letts[CP] = LETS[7] | ||
letts[C] = LETS[8] | ||
letts[CM] = LETS[9] | ||
|
||
letts[DP] = LETS[10] | ||
letts[D] = LETS[11] | ||
letts[DM] = LETS[12] | ||
|
||
letts[E] = LETS[13] | ||
|
||
|
||
return(list(grades=ggrades, lett=letts, scor=scores, divs=divs, LETS=LETS, SCRS=SCRS)) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
`jist` <- | ||
function(h, Z, L, col=2) | ||
{ | ||
if(missing(col)) { col = 1 } | ||
### h = histogram structure | ||
### Z = scores | ||
#### L = letter grades or labels | ||
|
||
J = rep(1, length(Z)) | ||
|
||
Kounts = c(0, h$counts) | ||
|
||
for(i in 1:length(Kounts)) | ||
{ | ||
if(Kounts[i]==0) next | ||
x1 = h$breaks[i] | ||
x2 = h$breaks[i+1] | ||
w = which(Z>=x1&Z<x2) | ||
k = Kounts[i] | ||
|
||
v = seq(1, length(w)) | ||
J[w] = v | ||
|
||
} | ||
i = length(Kounts) | ||
x2 = h$breaks[i] | ||
w = which(Z>=x2) | ||
if(length(w)>0) | ||
{ | ||
v = seq(1, length(w)) | ||
J[w] = v | ||
} | ||
|
||
text(Z, J, labels=L, col=col, xpd=TRUE, cex=.8, font=2) | ||
invisible(J) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
`make.exam` <- | ||
function(Qbank, ofile="examq.tex") | ||
{ | ||
if(missing(ofile)) { ofile = "examq.tex" } | ||
|
||
ansfile = paste(sep=".", ofile, "ANS") | ||
system(paste(sep=" ", "rm", ofile)) | ||
system(paste(sep=" ", "rm", ansfile)) | ||
|
||
for(i in 1:length(Qbank)) | ||
{ | ||
z = Qbank[[i]] | ||
A1 = substring(z$A, 3, 10000) | ||
A2 = paste("\\item {", A1, "}") | ||
|
||
THEQ = paste(z$Q) | ||
|
||
cat(file=ofile, "\\item {", sep="\n", append = TRUE) | ||
## cat(file=ofile, "\\begin{minipage}{1\\linewidth}", sep="\n", append = TRUE) | ||
|
||
cat(file=ofile, "\\setlength{\\itemsep}{0cm}", sep="\n", append = TRUE) | ||
cat(file=ofile, "\\setlength{\\parskip}{.2cm}", sep="\n", append = TRUE) | ||
|
||
cat(file=ofile, "\\begin{samepage}", sep="\n", append = TRUE) | ||
|
||
########### questions are in Bold Font | ||
cat(file=ofile, "\\textbf{", sep="\n", append = TRUE) | ||
cat(file=ofile, z$Q , sep="\n", append = TRUE) | ||
cat(file=ofile, "}", sep="\n", append = TRUE) | ||
cat(file=ofile, "\\begin{enumerate}", sep="\n", append = TRUE) | ||
cat(file=ofile, A2 , sep="\n", append = TRUE) | ||
|
||
cat(file=ofile, "\\end{enumerate}", sep="\n", append = TRUE) | ||
|
||
|
||
if(!is.null(z$FIG)) | ||
{ | ||
cat(file=ofile, "\\begin{figure}[htp]", sep="\n", append = TRUE) | ||
cat(file=ofile, "\\centering", sep="\n", append = TRUE) | ||
ofig = paste(sep="", "\\includegraphics[width=0.85\\textwidth]{", z$FIG$fn, "}") | ||
cat(file=ofile, ofig, sep="\n", append = TRUE) | ||
labfig = paste(sep="", "\\caption{}\\label{",z$FIG$tag ,"}") | ||
cat(file=ofile,labfig, sep="\n", append = TRUE) | ||
cat(file=ofile, "\\end{figure}", sep="\n", append = TRUE) | ||
} | ||
## cat(file=ofile, "}", sep="\n", append = TRUE) | ||
## cat(file=ofile, "\\end{minipage}", sep="\n", append = TRUE) | ||
cat(file=ofile, "\\end{samepage}", sep="\n", append = TRUE) | ||
|
||
cat(file=ofile, "}", sep="\n", append = TRUE) | ||
cat(file=ansfile, paste(i, z$a) , sep="\n", append = TRUE) | ||
} | ||
|
||
} | ||
|
Oops, something went wrong.