Description Usage Arguments Details Value See Also Examples
scoring
is a dual purpose function that returns a full dataframe that has
either been converted into standard scores based upon overall norms, or by
age and gender specific norms (based upon the norm argument). Age and Gender
are included as arguments simply to designate the names of the respective variables.
1 2 |
dat |
An R dataframe object containg the scale scores |
scoring.table |
An R dataframe object that provides means and standard deviations for each normative option. See example section for details. |
norm |
A character vector of length 1. Use "overall" for overall norms, and "agegender" for age and gender specific norms. |
Age |
A vector pertaining to the Age variable of length N. |
Gender |
A vector pertaining to the Gender variable of length N. |
This function requires an external R dataframe called 'scoring.table' that has the following structure: columns called SCALE (with scale names that match those in 'dat'), AGE, GENDER, MEAN, and SE. For the rows pertaining to overall norms, the AGE and GENDER values should be the character string "overall". See the example code for more details.
An R dataframe object with N rows and K columns, where K is the number of scales included in dat.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ## Not run:
set.seed(77)
scoring.table <- data.frame(SCALE = rep(LETTERS[1:5], 5),
AGE = c(rep("overall", 5),
rep(c("Young", "Old"), each = 5),
rep(c("Young", "Old"), each = 5)),
GENDER = c(rep("overall", 5), rep(c("Male", "Female"), each = 10)),
MEAN = rnorm(25, mean = 100, sd = 10),
SD = rnorm(25, mean = 10, sd = 3),
stringsAsFactors = FALSE)
set.seed(78)
n <- 500
dat <- data.frame(AGE = sample(c("Young","Old"), size = n, replace = TRUE),
GENDER = sample(c("Male","Female"), size = n, replace = TRUE),
A = rnorm(n, mean = 100, sd = 10),
B = rnorm(n, mean = 100, sd = 10),
C = rnorm(n, mean = 100, sd = 10),
D = rnorm(n, mean = 100, sd = 10),
E = rnorm(n, mean = 100, sd = 10))
overall <- scoring(dat[,3:7], scoring.table = scoring.table[1:5,], norm = "overall")
agegen <- scoring(dat[,3:7], scoring.table = scoring.table[6:25,], norm = "agegender",
Age = dat[,1], Gender = dat[,2])
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.