# NOT RUN {
library(Scalelink)
## Set the number of CPU cores to use (omit to use all available)
RcppParallel::setThreadOptions(numThreads = 2)
data(FOI, package = "Scalelink")
data(LDFCOMP, package = "Scalelink")
idcols <- c("Day", "Month", "Year", "Sex")
result <- calcScores(FOI[, idcols], LDFCOMP[, idcols])
print(result$scores)
## Scalelink package provides two examples using synthetic data
## one with complete data and one containing missing values
# }
# NOT RUN {
## For a list of demo titles
demo(package = 'Scalelink')
## To run a demo
demo(Example1)
## Using your own data
##If you had the following files in your working directory:
##FOI:
##A space-delimited file of interest (NFOI x PFOI). NFOI is number of records
##IDENTIFIERS_FOI:
##A space-delimited file containing a row vector length PFOI with a 1 where it is an identifier
##LDF:
##A space-delimited linking data file (NLDF x PLDF). NLDF is number of records
##IDENTIFIERS_LDF:
##A space-delimited file containing a row vector length PLDF with a 1 where it is an identifier
##Then you can calculate scores as follows:
FOI<-read.table("FOI")
LDF<-read.table("LDF")
IDENTIFIERS_FOI<-read.table('IDENTIFIERS_FOI')
IDENTIFIERS_LDF<-read.table('IDENTIFIERS_LDF')
result <- calcScores(FOI[, which(IDENTIFIERS_FOI == 1)], LDF[, which(IDENTIFIERS_LDF == 1)],
missing.value=-9.999e+029)
##To view the scores:
print(round(result$scores, 2))
##To view the A* matrix:
print(result$astar)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab