I have created a function in R called calibrate
, with the following call:
calibrate<-function(prior, p1=NULL, p2=NULL, p3=NULL, q13, q23,
accuracy=1e-7, sol=4, data, name_col=1, pval_col=2, tier_col=NULL)
The first thing that occurs in this function is:
if(!is.null(tier_col))
{
work<-as.data.frame(table(data[tier_col]))
p1<-work[,2][work[1]==1]
p2<-work[,2][work[1]==2]
p3<-work[,2][work[1]==3]
}
A lot of other things happen after this, but the function isn't getting past this.
The call that I am making is:
calibrate(prior=0.10, q13=3, q23=2, accuracy=1e-7, sol=4,
data=read.csv("C:/Users/C191131/Desktop/calibrate_test.csv"),
name_col=1, pval_col=2, tier_col=3)
where the data file has 3 columns, one for name, one for pvalue, and one for tier. As you can see, tier_col
is being set to 3 and then immediately when entering the function, it should be checked to see if it is null.
When I make the call, I get the following error:
Error in calibrate(prior = 0.1, q13 = 3, q23 = 2, accuracy = 1e-07, sol = 4, :
unused argument (tier_col = 3)
I don't understand how this can be happening, since the first thing I do when entering the function is call upon the tier_col
variable.
Any help/ideas? I have researched this error to no avail.
Thanks!!