tcata.line.plot: Temporal Check-All-That-Apply (TCATA) curve

Description Usage Arguments References Examples

View source: R/tcata.R

Description

Plots TCATA curves based on count or proportion data. Can also be used for plotting Temporal Dominance of Sensations (TDS) curves based on dominance counts or proportions.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
tcata.line.plot(X, n = 1, attributes = c(), times = c(), lwd = 1,
emphasis = NA, emphasis.lty = 1, emphasis.lwd = 3, declutter = NA,
chance.lty = 3, reference = NA, ref.lty = 2, ref.lwd = 1,
highlight = FALSE, highlight.lty = 1, highlight.lwd = 5, highlight.col = c(),
height = 8, width = 12, main = "",
xlab = "Time", ylab = "Citation proportion", axes.font = 1,
axes.cex = 1, xlim = c(), las = 0, line.col = c(),
x.increment = 5, legend.cex = 1, legend.font = 1,
legend.pos = "topleft", legend.ncol = 2, box = FALSE,
save.format = "", save.as = "" )

Arguments

X

matrix of proportions (or, if there is no missing data, on counts), typically with Attributes in rows and times in columns.

n

The number of observations if X is a count matrix. Keep n = 1 if X is a matrix of proportions.

attributes

a vector of attribute labels, corresponding to the attributes in X.

times

a vector of time, corresponding to the times in X.

lwd

Line width used when plotting attribute curves in X.

emphasis

a matrix matching X in its dimensions, with a numeric value corresponding to points requiring emphasis, and NA for points without emphasis.

emphasis.lty

Controls the line type associated with the emphasis line.

emphasis.lwd

Controls the line weight associated with the emphasis line.

declutter

a matrix matching X in its dimensions, with a numeric value corresponding to points that will not be plotted.

chance.lty

line type for the chance line. (May be deprecated?)

reference

a matrix matching X in its dimensions, with a numeric value corresponding to points where a reference line will be displayed, and NA for points where no reference line will be shown.

ref.lty

reference line type.

ref.lwd

reference line width.

highlight

a matrix matching X in its dimensions, with a numeric value corresponding to points requiring highlighting, and NA for points without highlighting

highlight.lty

Controls the line type associated with the highlighting.

highlight.lwd

Controls the line weight associated with the highlighting line.

highlight.col

a vector of colours for attributes corresponding to rows of X.

height

Window height.

width

Window width.

main

plot title; see plot.

xlab

Label for the x axis.

ylab

Label for the y axis.

axes.font

Font for axes labels; see par.

axes.cex

Size for axes labels.

xlim

Permits control of the x limit. Limits can be specified using a vector of 2 (ascending) numbers.

las

numeric in 0,1,2,3; the style of the axis labels. See par.

line.col

A vector of colors for lines corresponding to rows of X.

x.increment

Specifies the interval between times when labelling the x axis.

legend.cex

Size of markers shown in the legend.

legend.font

Font for the legend; see text.

legend.pos

Location of the legend in the plot; defaults to "topleft".

legend.ncol

Number of columns in legend.

box

draw box around plot area; see: box

save.format

If indicated, this will be the fle type for the save image. Defaults to "eps" (eps format). Other possible values are "" (not saved) or "png" (png format).

save.as

Filename if the file will be saved.

References

Castura, J. C., Antúnez, L., Giménez, A., Ares, G. (2016). Temporal check-all-that-apply (TCATA): A novel temporal sensory method for characterizing products. Food Quality and Preference, 47, 79-90. http://dx.doi.org/10.1016/j.foodqual.2015.06.017

Examples

 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
26
27
# example using 'syrah' data set
low1 <- t(syrah[seq(3, 1026, by = 6), -c(1:4)])
colnames(low1) <- 10:180
tcata.line.plot(get.smooth(low1), lwd = 2, main = "Low-ethanol wine (Sip 1)")

# example using 'ojtcata' data set
data(ojtcata)
x <- aggregate(ojtcata[, -c(1:4)], list(samp = ojtcata$samp, attribute = ojtcata$attribute), sum)
p.1.checked <- x[x$samp == 1, -c(1:2)]
p.1.eval <- length(unique(ojtcata$cons))
p.not1.checked <- aggregate(x[, -c(1:2)], list(attribute = x$attribute), sum)[, -1]
p.not1.eval <- length(unique(ojtcata$cons)) * (length(unique(ojtcata$samp)) - 1)

# reference lines for contrast products
p.1.refline <- p.not1.checked / p.not1.eval
# decluttering matrix corresponds to the dimensions of p.1.refline
p.1.declutter <- matrix(get.decluttered(x = unlist(p.1.checked), n.x = p.1.eval,
                                        y = unlist(p.not1.checked), n.y = p.not1.eval),
                        nrow = nrow(p.1.checked))
times <- get.times(colnames(x)[-c(1:2)])
attributes <- unique(x$attribute)
palettes <- make.palettes(length(attributes))
tcata.line.plot(p.1.checked, n = p.1.eval, attributes = attributes, times = times,
                reference = p.1.refline, ref.lty = 3, declutter = p.1.declutter,
                highlight = TRUE, highlight.lwd = 4,
                line.col = palettes$pal, highlight.col = palettes$pal.light,
                main = "Sample 1", height = 7, width = 11, legend.cex = 0.7)

Example output

dev.new(): using pdf(file="Rplots1.pdf")

tempR documentation built on May 2, 2019, 9:33 a.m.