R package to analyse Q methodology data
Would you like to send the author an enquiry about Q methodology? Read this first.A Q study can quickly involve quite a lot of different kinds of interrelated data, including a concourse, a Q set (or sample), a condition of instruction as well as the actual Q sorts. This page suggests some best practices for reproducible, cumulative and systematic Q research, as developed during the first keyneson study.
These best practices can be best implemented using the import functions import.q.concourse
, build.q.set
, import.q.sorts
, import.q.feedback
and the print function make.cards
, allowing for a one-stop-shop development, iteration and administration of a Q study.
However, nothing in the R Package qmethod
requires that you follow these best practices; functions are generic and applicable to a wide range of use cases.
Not all of these practices and facilities will be immediately appropriate for all studies, especially small and ad-hoc studies. However, as Q methodology grows and consolidates, more researchers may confront similar challenges to which these best practices provide preliminary solutions.
The below suggestions proceed from simpler, basic to more advanced data management suggestions.
TL;DR: If you’d rather not read a lengthy piece, but look at an example and get started right away, check out Max Held’s Q study
keyneson
, for which these practices were developed.
In spite of the great diversity of approaches to Q methodology, some criteria of good research practice may be universally acceptable, including:
Items in a Q set or concourse may need to be referred to in different ways, depending on the study.
Items themselves may take many forms, including longer or shorter written language, but also other stimulus material such as pictures. Conventionally, let us refer to this as the full item stimulus or full item wording, depending on the stimulus. An example (from keyneson) would be:
Labor is not a commodity.
Full item wordings may best be saved as individual text files in one directory.
It is recommended to use flat text files and not binary/proprietary word processor files (such as ), because the former are smaller, more robust, future-proof and easily transferable.
A full item wording file may simply look like this:*.doc
Labor is not a commodity.
The import function import.q.concourse
included with the R package qmethod
expects *.TEX
as a file extension (which stands for the LaTeX typesetting language, but LaTeX markup is strictly optional.
If you wish to use LaTeX formatting, you can just add markup as in a normal LaTeX file, with no preamble or other declarations needed.
For example,
Labor is \emph{not} a commodity.
would yield
Labor is not a commodity.
Depending on the length of these items, and the desired output format, researchers may find it cumbersome to always refer to items by their full item wording.
Instead, items can be conveniently assigned an item handle, which should be short and meaningful to the researcher (say, labor-no-commodity
, for the above example).
Researcher can then use this item handle to:
labor-no-commodity.tex
)/english/labor-no-commodity.tex
)labor-no-commodity-1.tex
, preferably by a version control program as suggested below).identify items quickly during factor interpretations or in visualizations, as in the following example:
Item
labor-no-commodity
is a distinguishing statement for factor 1.
link item feedback from participants (or other people) to an item, as in the following example *.csv
file:
handle,feedback
labor-no-commodity,"I don't know what a commodity is."
identify items to be sampled from a concourse into a Q set as in the following example sample.csv
file:
labor-no-commodity,
growth-trumps-equality,
...
Another need to refer to items in some shorthand way arises during the administration of a Q study. To record participant Q sorts, it would often be too cumbersome to refer to items by their full wording. Instead, researchers will usually enter some short identifier to record a participants Q sort.
In some settings, it may also not be advisable to have participants see the above item handles, because these meaningful snippets may be understood as additional stimulus by participants, and affect their sorts in unintended ways. (This may be a similar effect to using Q-cards made from different material, or in different colors for different items).
For that reason, a unintelligible identifier, or ID may be advisable to refer to items for Q sort administration.
The import functions import.q.sorts
, import.q.feedback
and the printing function make.cards
included in the R package qmethod
allow for two ways of doing this:
Researchers can manually enter arbitrary strings to identify items, such as the customary sta001
.
In this case, researcher should specify their manual IDs using the manual.lookup
options in the above functions (see R documentation for details).
Such manual IDs can either be “hard-coded” in R, or they can be conveniently read in from a *.csv
file using the read.csv
function of base R.
Such an example ids.csv
file may look like this:
handle,id
labor-no-commodity,sta001
growth-trumps-equality,sta002
...
3ed68fde
.```
Labor is not a commodity.
```
is changed to
```
Labor is something that can be bought and sold like everything else on the market.
```
the hash value created by `make.cards` and expected by input functions will *automatically* change, thus negating the possibility of confusing one item version for another.
Using hash values (and proper version control), researchers will always know exactly what variant of an item people saw and sorted.
This is how items created by make.cards
using an ID look like (in this case, a manual ID):
You can easily break out individual cards, with their ID on the back, and the full item wording on the front:
Notice (from the qmethod
manual):
Hashed identification has not been widely tested in Q studies and should be used with great care and only for extra convenience. When using hash identification, researchers should be careful to record the precise item wordings at the time of hashing for the printed Q cards, preferably with a version control system. Researchers should also record the complete Q sorts of participants in an unhashed form, such as a picture of the completed sort in full wordings, in case problems with the hashing arise.
This function currently only works for Avery Zweckform C32010 templates, designed in/cardtemplates/AveryZweckformC32010.Rnw
. If you would like support for other templates, check out / chip in here.
The simplest directory structure, starting from the root of some Q study, should look like this:
├── feedback
│ └── JohnDoe.csv # these include possible feedback with one line per item
├── qsorts
│ ├── JaneDoe.csv # these include the full sorts, recorded in raw form
│ └── JohnDoe.csv
└── sample
├── concourse
│ ├── life-with-q.tex # these include the full item wordings
│ ├── q-uprising.tex
│ ├── r-dominance.tex
│ ├── small-village.tex
│ └── video.tex
│ └── ids.csv # this includes the IDs, if hard entered
└── sampling-structure.csv # this includes a list of items to be sampled into the q-set
The import and print functions in qmethod
also support multilingual, and multi-condition Q studies.
In this case, the arguments conditions
and languages
should be specified when calling the functions.
The functions will then expect these conditions and languages in the directory structure.
With all bells and whistles, taken from the importexample
data shipped with qmethod
, a directory should look like this:
├── feedback
│ ├── after # same conditions as specified in function call
│ │ └── JohnDoe.csv
│ └── before
├── qsorts
│ ├── after # same conditions as specified in function call
│ │ ├── JaneDoe.csv
│ │ └── JohnDoe.csv
│ └── before
│ ├── JaneDoe.csv
│ └── JohnDoe.csv
└── sample
├── concourse
│ ├── english # same languages as specified in function call
│ │ ├── life-with-q.tex
│ │ ├── q-uprising.tex
│ │ ├── r-dominance.tex
│ │ ├── small-village.tex
│ │ └── video.tex
│ ├── german
│ │ ├── life-with-q.tex
│ │ ├── q-uprising.tex
│ │ ├── r-dominance.tex
│ │ ├── small-village.tex
│ │ └── video.tex
│ └── ids.csv
└── sampling-structure.csv
The above directory includes the following different kinds of files:
This is where you store item feedback received from participants.
The idea of these files is that such item feedback may be instructive in later factor interpretations, during which it can be called programmatically.
JohnDoe.csv
*.CSV
, or comma-separated values files, that can be produced in most spreadsheet editors.import.q.feedback
they include columns for the ID, feedback, and whether said feedback was just a correction (such as a typo), which may not be of greater interest to the researcher in later analysis." "
to allow for commas within a piece of feedback.A file may look like this:
item_id,item_feedback,correction
i01,"I don't like Asterix and Obelix",FALSE
i02,"There is a typo here!",TRUE
This is where you record raw Q-sorts, as prepared by participants.
JohnDoe.csv
*.CSV
, or comma-separated values files, that can be produced in most spreadsheet editors.import.q.sorts
(header = TRUE
) they start a header of variable names in the first line.
Variable names are ignored by import.q.sorts
but should be the rank orders ("-3"
etc.) for consistency.-4
to +4
), rows are (as in Q-sorts) meaningless, and cells include items by their IDs.A very simple file may look like this:
"-1","0","1" # this first line will be interpreted as variable names
,i01,
i02,i03,i04
This is where you save actual full item wordings.
life-with-q.tex
.*.TEX
, but need not include LaTeX markup — just text suffices.
(see above)A very simple file may look like this:
And life is not easy for the R-legionaries who bother to read the works of Stephenson and Brown, for these posit actual Q logics of inquiry.
If manual IDs are used (not recommended), that file may also be saved as a *.csv
to enable others to reproduce it.
Conventions are not important, so as long as the file is correctly read in and modified as expected for input in import.q.sorts
or make.cards
.
An ID file may look like this:
ID,handle
i01,r-dominance
i02,q-uprising
i03,small-village
i04,life-with-q
i05,video
If a Q set is a selected from a concourse using structured sampling, that sampling subset may also be saved as a *.csv
, to enable others to reproduce it.
Conventions are not important, so as long as the file is correctly read in and modified as expected for input in build.q.set
.
An sampling structure file may include arbitrary additional columns, but should include the item handles
.
A sampling file may look like this:
handle
life-with-q
q-uprising
r-dominance
small-village
Maintaining such a directory structure and the below file types has a number of advantages and enables good research practice.
git submodule
.
Git submodules are essentially Git projects inside other git projects, where a superproject always includes a pointer to a particular version of a subproject.
Git submodules can initially appear unintuitive and lead to unexpected results, but if used appropriately, suit a cumulative Q research project very well.
If the root
(= the Q study, including Q sorts), sample
(= the Q set), and the concourse
folder in the above are all independently versioned as nested submodules, any given Q study is defined by a precise pointer to some version of a Q set, which in turn is defined by a precise pointer to some version of a concourse.
At the same time, other researchers can use arbitrarily different combinations of sample
and concourse
for their research projects, while maintaining a systematic relationship between different efforts.If you’re curious, what a Q study with all of these suggestions looks like, check out Max Held’s keyneson
repository.
A selection of that directory structure looks like this:
├── README.md
├── feedback
│ ├── after
│ │ ├── Frank.csv
│ │ ├── Ingrid.csv
│ │ ├── ...
│ │ └── Wolfgang.csv
│ └── before
│ ├── Claus.csv
│ ├── Frank.csv
│ ├── ...
│ └── Susanne.csv
├── keyneson-sample # this is a git submodule
│ ├── README.md
│ ├── keyneson-concourse # this is a git submodule
│ │ ├── README.md
│ │ ├── english
│ │ │ ├── ability-2-pay.tex
│ │ │ ├── all-people-own-earth.tex
│ │ │ ├── ...
│ │ │ └── yield-2-capital-norm.tex
│ │ ├── german
│ │ │ ├── ability-2-pay.tex
│ │ │ ├── all-people-own-earth.tex
│ │ │ ├── ...
│ │ │ └── yield-2-capital-norm.tex
│ │ ├── ids.csv
│ │ └── keyneson-concourse.wiki # this is a git submodule
│ │ └── Home.md
│ ├── keyneson-sample.wiki # this is a git submodule
│ │ ├── Home.md
│ │ └── sampling-structure.md
│ └── sampling-structure.csv
├── keyneson.wiki # this is a git submodule
│ ├── Home.md
│ ├── Q-Sort-Form.pdf
│ └── condition-of-instruction-de.md
└── qsorts
├── after
│ ├── Christian.csv
│ ├── Frank.csv
│ ├── ...
│ └── Wolfgang.csv
└── before
├── Christian.csv
├── Claus.csv
├── ...
└── Wolfgang.csv