From ab4147b484f973d6320e6fc95f7de9bff35c570e Mon Sep 17 00:00:00 2001 From: Titus von der Malsburg Date: Tue, 25 Aug 2015 12:58:29 +0200 Subject: [PATCH] Fixed a bug in prepare.data which prevented the plotting function to fail in some situations. --- scanpath/R/scanpath.R | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scanpath/R/scanpath.R b/scanpath/R/scanpath.R index ba54c01..7c94206 100644 --- a/scanpath/R/scanpath.R +++ b/scanpath/R/scanpath.R @@ -262,9 +262,12 @@ avg.group.dist <- function(d, groups) { prepare.data <- function(data, formula) { terms <- strsplit(deparse(formula), " [~+|] ")[[1]] - stopifnot(length(terms)==4) + stopifnot(length(terms) %in% 3:4) df <- data[terms] - colnames(df) <- c("d", "x", "y", "trial") + if (length(terms)==3) + colnames(df) <- c("d", "x", "trial") + else + colnames(df) <- c("d", "x", "y", "trial") df }