Learn R Programming

matRiks

The goal of matRiks is to generate Raven-like stimuli according to rules. This package has been developed by Dr. Andrea Brancaccio and Dr. Ottavia M. Epifania.

What it does

The matRiks package is a convenient tool for generating Raven-like stimuli according to both logical rules (i.e., the relationships between the elements in the matrix are manipulated to create the matrix) and visuospatial rules (i.e., the visual or spatial characteristics of the elements are manipulated to generate the matrix). The response list associated with each matrix is generated as well, containing 11 response options (i.e., one correct response and 10 distractors) among which the users can choose the most apt for their aims. The distractors are bound to both the rules and the directional logic that have been used for generating the matrix. As such, not all the distractors can be generated for all the matrices. In case a distractor can not be generated for a given matrix, a warning is thrown and the distractors is covered by a thick black X.

Installation

You can install the development version of matRiks from GitHub with:

# install.packages("devtools")
devtools::install_github("OttaviaE/matRiks")

Example

This code provides an example on how to generate a basic matriks by using one figure (pacman()) and manipulating its rotation (rotate) horizontally:

library(matRiks)
#> Warning: il pacchetto 'matRiks' è stato creato con R versione 4.3.2
#> 
#> Caricamento pacchetto: 'matRiks'
#> Il seguente oggetto è mascherato da 'package:methods':
#> 
#>     show
#> I seguenti oggetti sono mascherati da 'package:base':
#> 
#>     identity, replace
## Generate a simple matriks by horizontally rotating a pacman
my_mat <- mat_apply(pacman(), hrules = "rotate")
# draw the matriks 
draw(my_mat)

Along with the matriks, its associated response list can be generated as well:

# generate the response list
responses <- response_list(my_mat)
#> Warning in repetition.matriks(obj): R-Top is equal to the correct response
#> Warning in ic_inc.matriks(obj): IC-Inc cannot be obtained with a single figure
# draw the response list and print the title of the distractors
draw(responses, main = TRUE)

Since two distractors cannot be generated given the rule and the directional logic used for generating the matriks, two warnings are thrown and the related distractors are crossed out by a thick black X.

This code print a small selection of distractors:

draw(responses, main = TRUE, distractors = c("correct", "r_diag", "wp_matrix", "difference", "ic_flip"))

Copy Link

Version

Install

install.packages('matRiks')

Monthly Downloads

140

Version

0.1.5

License

MIT + file LICENSE

Maintainer

Andrea Brancaccio

Last Published

December 19th, 2025

Functions in matRiks (0.1.5)

dot

Coordinates of a dot
pacman

Coordinates of a pacman
response_list

Response list (Method)
replace

Replace figures (Method)
phantom

Coordinates of a panthom figure
pentagon

Coordinates of a pentagon
miley

Define the coordinates of a miley
split_mat

Split the correct response (Method)
shade

Shade rule (Method)
maxi

Coordinates of a maxi
square

Coordinates of a square
semi_circle_top

Coordinates of a downward-facing left semi-circle
up_petal

Define the coordinates of petals
v_arc_left_up

Coordinates for drawing circle arches
wp

Wrong principle distractors (method)
size

Sizing rule (Method)
slice

Coordinates of a pizza slice
malta

Coordinates of a Malta cross
shape

Shape rule (Method)
draw

Draw (Method)
luck

Coordinates of a luck
star

Coordinates of a star
show

Show figures (Method)
margin

Margin rule (Method)
rotate

Rotation rule (Method)
semi_circle_bottom_inv

Coordinates of an upward-facing left semi-circle
triangle

Coordinates of a triangle
vert_bow_tie

Coordinates of bow ties
vertical_eight

Eight-shaped figures
pizza_4

Coordinates of a pizza with four slices
mat_apply

Apply rule to generate a matriks (method)
repetition

Repetition distractors (Method)
vertical_s

Coordinates of S-shaped figures
vline

Coordinates of lines
change_color

Change shade
difference

Difference distractor (Method)
decof

Split the elements of a figure (Method)
cof

Concatenation of figures (method)
biscuit

Coordinates of a biscuit
dice

Coordinates of a dice with four dots
cross

Coordinates of a cross
correct

Correct response (Method)
circle

Coordinates of a circle
axe

Coordinates of an axe
hide

Hide figures (Method)
lily

Define the coordinates of a lily
hexagon

Coordinates of a hexagon
hide.figure

Hide figures
ellipse

Coordinates of an ellipse
logic

Logical rules (Method)
ic

Incomplete correlate distractors (method)
identity

Identity rule (Method)
ninja

Coordinates of a ninja star