View source: R/predict_values.R
predict_quality | R Documentation |
Apply scoring models to ReaderBench, CohMetrix, and/or GAMET files. Holistic writing quality can be generated from Readerbench (model = 'rb_mod2') or Coh-Metrix files (model = 'coh_mod2'). Also, Correct Word Sequences and Correct Minus Incorrect Word Sequences can be generated from a GAMET file (model = 'gamet_cws1').
predict_quality(model, data, store = FALSE, name = "filename.csv")
model |
A string telling which scoring model to use. Options are: 'rb_mod1', 'rb_mod2', 'rb_mod3narr', 'rb_mod3exp', 'rb_mod3per', 'rb_mod3all', 'rb_mod3narr_v2', 'rb_mod3exp_v2', 'rb_mod3per_v2', or 'rb_mod3all_v2' for ReaderBench files to generate holistic quality, 'coh_mod1', 'coh_mod2' 'coh_mod3narr', 'coh_mod3exp', 'coh_mod3per' or 'coh_mod3all' for Coh-Metrix files to generate holistic quality, and 'gamet_cws1' to generate Correct Word Sequences (CWS) and Correct Minus Incorrect Word Sequences (CIWS) scores from a GAMET file. |
data |
The name of the R object corresponding to the data file. The
|
store |
When store = TRUE, this function will generate scores, merge the scores into the data file, and export the file as .csv in the working directory. When store = FALSE (the default) the predicted scores are returned to a user-specified object or the R console. |
name |
When store = TRUE, the name parameter gives the filename for the .csv file (for example, "filename.csv") that is generated to the working directory. |
Depending on the model parameter option selected, predicted quality (or CWS/CIWS scores) and the ID variable (parsed from the file names used when generating the ReaderBench, Coh-Metrix, and/or GAMET output files) are returned.
Sterett H. Mercer <sterett.mercer@ubc.ca>
import_rb
import_coh
import_gamet
###Examples using sample data included in writeAlizer package
##Example 1: ReaderBench output file
#load package
library(writeAlizer)
#get path of sample ReaderBench output file
file_path1 <- system.file("extdata", "sample_rb.csv", package = "writeAlizer")
#see path to sample file
file_path1
#import file and store as "rb_file"
rb_file <- import_rb(file_path1)
#Generate holistic quality from "rb_file"
#and return scores to an object called "rb_quality":
rb_quality <- predict_quality('rb_mod2', rb_file, store = FALSE)
#display quality scores
rb_quality
##Example 2: Coh-Metrix output file
#get path of sample Coh-Metrix output file
file_path2 <- system.file("extdata", "sample_coh.csv", package = "writeAlizer")
#see path to sample file
file_path2
#import file and store as "coh_file"
coh_file <- import_coh(file_path2)
#Generate holistic quality from a Coh-Metrix file (coh_file),
#return scores to an object called "coh_quality",
coh_quality <- predict_quality('coh_mod2', coh_file, store = FALSE)
#display quality scores
coh_quality
##Example 3: GAMET output file
#get path of sample GAMET output file
file_path3 <- system.file("extdata", "sample_gamet.csv", package = "writeAlizer")
#see path to sample GAMET file
file_path3
#import files, merge, and store as "gam_file"
gam_file <- import_gamet(file_path3)
#Generate CWS and CIWS scores from a GAMET file
#(gam_file) and return scores to an object called "gamet_CWS_CIWS"
gamet_CWS_CIWS <- predict_quality('gamet_cws1', gam_file, store = FALSE)
#display quality scores
gamet_CWS_CIWS
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.