Last data update: 2014.03.03

R: Plot figural analogies.
plot_faR Documentation

Plot figural analogies.

Description

plot_fa plots the information of figural analogies. This information is previously generated with function build_fa.

Usage

plot_fa(items, which = 0, mode = "A", language = "E",
  language.dir = "A", form.int = "A", form.ext = "A", size.shape = 1,
  size.dot = 2, size.line = 1, size.q = 3.5, size.word = 1.2,
  info = T, directory = F, switch.from = 0, switch.to = 0)

Arguments

items

An object of class 'fa_items' generated with function build_fa. No default.

which

A numeric vector designating which isomorph(s) to plot. Plot all by default.

mode

A character string designating plot mode "A", "B" or "C". Plot mode "A" by default.

language

A character string designating English ("E"), German ("D") or Spanish ("S") language. Default is "E".

language.dir

A character string designating language for output files. "A" by default selects all languages.

form.int

A character string designating the form from "A" to "D" of the internal main shape, or "R" for random. Default is "A".

form.ext

A character string designating the form from "A" to "D" of the trapezium, or "R" for random. Default is "A".

size.shape

A number designating the size of every shape. Default is 1.

size.dot

A number designating the size of every shape dot. Default is 2.

size.line

A number designating the thickness of every shape. Default is 1.

size.q

A number designating the size of the question mark. Default is 3.5.

size.word

A number designating the size of the verbal options. Default is 1.2.

info

Should rules applied and correct answers be informed? True by default.

directory

Character string designating a file in your PC where to store the isomorphs.

switch.from

Number 'p' designating an option from 1 to 8 to switch with 'q'.

switch.to

Number 'q' designating an option from 1 to 8 to switch with 'p'.

Details

The plot_fa function should not be assigned to an object, except when willing to use the optional arguments switch.from and switch.to. In the latter case, the object name should be the same as the name of the object of class 'fa_items', and argument which must designate the isomorph to be affected even if there is only one isomorph available. For example:

object <- plot_fa(object, which = 1,
switch.from = 1, switch.to = 2)

Value

A data frame containing rules applied and right answers when info=T by default, or an object of class 'fa_items' when which has length 1, its value is greater than 0 and both switch.from and switch.to are greater than 0.

Author(s)

Diego Blum <blumworx@gmail.com>

References

Blum, D., Holling, H., Galibert, M.S., & Forthmann, B. (2016). Task difficulty prediction of figural analogies. Intelligence, 56, 72-81.

See Also

IMak

Examples

## Create two isomorphs with one rule, setting the correct answer to 1:
one <- build_fa(isomorphs = 2, dot.mov = c(1, 2), correct = 1)
## Plot them:
plot_fa(one)
## Change the correct answer of item 2 from position 1 to position 2:
one <- plot_fa(one, which = 2, switch.from = 1, switch.to = 2)
## Choose a directory and save the items:
# dir1 <- "enter your new directory here"
# plot_fa(one, directory = dir1)

## Create four isomorphs with two rules:
two <- build_fa(isomorphs = 4, mirror = 1, trap.rot = c(90, 45))
## Plot them in German language:
plot_fa(two, language = "D")
## Plot only items 2 and 3 in Spanish and choose form "B" for the internal main shape:
plot_fa(two, language = "S", form.int = "B", which = c(2, 3))
## Choose a different directory and save these two items by keeping the latter configuration:
# dir2 <- "enter your new directory here"
# plot_fa(two, which = c(2, 3), language.dir = "S", form.int = "B", directory = dir2)

## Create 20 isomorphs with three rules. Set automatic=F and affect the options:
three <- build_fa(isomorphs = 20, mirror = 1, trap.rot = c(90, 45), dot.mov = c(1, 2),
automatic = FALSE, al.mirror = c(0, 1), al.trap.rot = -45, al.dot.mov = 1)
## Plot them:
plot_fa(three)
## Plot each individual shape of item 13 in German language only:
plot_fa(three, which = 13, mode = "C", language = "D")
## Choose a different directory and save the item parts:
# dir3 <- "enter your new directory here"
# plot_fa(three, which = 13, mode = "C", language.dir = "D", directory = dir3)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(IMak)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/IMak/plot_fa.Rd_%03d_medium.png", width=480, height=480)
> ### Name: plot_fa
> ### Title: Plot figural analogies.
> ### Aliases: plot_fa
> 
> ### ** Examples
> 
> ## Create two isomorphs with one rule, setting the correct answer to 1:
> one <- build_fa(isomorphs = 2, dot.mov = c(1, 2), correct = 1)
> ## Plot them:
> plot_fa(one)
  Isomorphs Correct            General rules        Total
1         1       1        Dot edge movement            2
2         2       1                                      
> ## Change the correct answer of item 2 from position 1 to position 2:
> one <- plot_fa(one, which = 2, switch.from = 1, switch.to = 2)
Warning message:
In plot_fa(one, which = 2, switch.from = 1, switch.to = 2) :
  Correct answer of item 2 changed to position 2.
> ## Choose a directory and save the items:
> # dir1 <- "enter your new directory here"
> # plot_fa(one, directory = dir1)
> 
> ## Create four isomorphs with two rules:
> two <- build_fa(isomorphs = 4, mirror = 1, trap.rot = c(90, 45))
> ## Plot them in German language:
> plot_fa(two, language = "D")
  Isomorphs Correct             General rules        Total
1         1       2                Reflection            4
2         2       4        Trapezium rotation             
3         3       7                                       
4         4       1                                       
> ## Plot only items 2 and 3 in Spanish and choose form "B" for the internal main shape:
> plot_fa(two, language = "S", form.int = "B", which = c(2, 3))
  Isomorphs Correct             General rules        Total
1         2       4                Reflection            2
2         3       7        Trapezium rotation             
> ## Choose a different directory and save these two items by keeping the latter configuration:
> # dir2 <- "enter your new directory here"
> # plot_fa(two, which = c(2, 3), language.dir = "S", form.int = "B", directory = dir2)
> 
> ## Create 20 isomorphs with three rules. Set automatic=F and affect the options:
> three <- build_fa(isomorphs = 20, mirror = 1, trap.rot = c(90, 45), dot.mov = c(1, 2),
+ automatic = FALSE, al.mirror = c(0, 1), al.trap.rot = -45, al.dot.mov = 1)
Warning messages:
1: In shape_options(options) :
  An alternative dot position solution had to be resampled in item 4.
2: In shape_options(options) :
  An alternative dot position solution had to be resampled in item 9.
> ## Plot them:
> plot_fa(three)
   Isomorphs Correct             General rules        Total
1          1       8                Reflection           20
2          2       8        Trapezium rotation             
3          3       2         Dot edge movement             
4          4       3                                       
5          5       8                                       
6          6       3                                       
7          7       4                                       
8          8       7                                       
9          9       8                                       
10        10       9                                       
11        11       9                                       
12        12       8                                       
13        13       4                                       
14        14       7                                       
15        15       9                                       
16        16       7                                       
17        17       3                                       
18        18       7                                       
19        19       5                                       
20        20       7                                       
> ## Plot each individual shape of item 13 in German language only:
> plot_fa(three, which = 13, mode = "C", language = "D")
  Isomorphs Correct             General rules        Total
1        13       4                Reflection            1
2                          Trapezium rotation             
3                           Dot edge movement             
> ## Choose a different directory and save the item parts:
> # dir3 <- "enter your new directory here"
> # plot_fa(three, which = 13, mode = "C", language.dir = "D", directory = dir3)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>