Skip to content

Commit

Permalink
Fixed a bug in prepare.data which prevented the plotting function to
Browse files Browse the repository at this point in the history
fail in some situations.
  • Loading branch information
tmalsburg committed Aug 25, 2015
1 parent da96f20 commit ab4147b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scanpath/R/scanpath.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit ab4147b

Please sign in to comment.