I am almost a beginner in R so please forgive me if i sound stupid. here is my situation:
I simulated 960 different reply patterns for a 10-item test. they are stored in my directory in .txt format as pairs, so there are 480 pairs of text files. they are named like: x_a_b_c_d or y_a_b_c_d where a, b, c and d are numbers. a is between 1 and 3, b and c are between 1 and 4 and d is between 1 and 10. I need to call each pair from the directory, convert them into frequency tables and equate them. I can do this one by one:
First I call a pair from the directory and turn them into frequency tables with freqtab()
function (because equate()
only works with them).
path1<-"directory//x_1_1_1_1.txt"
x1<-(read.table(path1, header=TRUE))
ftx1<-freqtab(x1, items = list(1:10, 9:10), scales = list(0:10, 0:2))
path2<-"directory//y_1_1_1_1.txt"
y1<-(read.table(path2, header=TRUE))
fty1<-freqtab(y1, items = list(1:10, 9:10), scales = list(0:10, 0:2))
then i equate them as in:
eq1<- equate(ftx1, fty1, type="linear", method="levine", ws=1)$conc$yx
however, I need to do that for all of the pairs one by one. so is there any way that I can call .txt files as pairs and equate them in one function?