Skip to content
R code for scoring some commonly used psychology measures
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

R code for scoring psychological testing measures

For most scales the default is alpha=F to return item scores. Pass alpha=T if you only want alpha values.

The term df is used to denote the input dataframe eg. for the rse the input value df could be represented by: data.frame(matrix(,100, TRUE), ncol=10)) although this example is unlikely to produce valid values for scoring

The number of columns is assumed to be the number of questions in the dataset. For example: in the IPIP 50, which has 50 questions, it is expected that your dataframe will have 50 columns where each column is a response to a question. Eg. column 1 is the response to the first question etc.


Functions to view data in APA format or calculate P and F from models

  • Output correlation in APA style

    • apaCorr2<-function(df,round_digits=2)
      • example: apaCorr2(data.frame(,10,replace=T),,10,replace=T)))
  • Shortcut function to calculate p-val from a linear model object

    • lmp <- function (modelobject)
      • example: lmp(lm(csv$bfat~csv$exer))
  • takes in linear model outputs: F(dfb,dfw)=fobt,p-val

    • prettyF<-function(x)
      • example: prettyF(lm(csv$bfat~csv$exer))
  • get semi-partial correlation

    • partial_df<-function(x,cont)
      • #example call: semi_partial_df(res,"gender") //where the dataframe has a column gender
You can’t perform that action at this time.