-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
Package: FDBeye | ||
Type: Package | ||
Title: Functions to Ease Work with Eyetracker Data | ||
Version: 0.0.19 | ||
Date: 2016-10-25 | ||
Version: 0.0.20 | ||
Date: 2017-06-28 | ||
Authors@R: c( | ||
person("David", "Braze", email="[email protected]", role=c("aut", "cre")), | ||
person("Tao", "Gong", role="aut"), | ||
|
@@ -20,6 +20,7 @@ Imports: | |
grid, | ||
plyr, | ||
png, | ||
purrr, | ||
stats, | ||
stringr, | ||
tools, | ||
|
@@ -35,7 +36,7 @@ License: MIT + file LICENSE | |
LazyData: true | ||
URL: https://github.com/davebraze/FDBeye | ||
BugReports: https://github.com/davebraze/FDBeye/issues | ||
RoxygenNote: 5.0.1 | ||
RoxygenNote: 6.0.1 | ||
Suggests: | ||
knitr, | ||
rmarkdown | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
##' @title Find the nearest Point of Interest for each fixation. | ||
##' | ||
##' @description For each fixation in a fixation report, this function | ||
##' will determine the nearest Point of Interest and the | ||
##' fixation's distance from that Point of Interest. | ||
##' | ||
##' @details For each fixation in a fixation report, this function | ||
##' will determine the nearest Point of Interest and the | ||
##' fixation's distance from that Point of Interest. | ||
##' | ||
##' The value of \code{supplement} determines whether to return | ||
##' the POI values within an enriched version of \code{fixReport}, | ||
##' or as a simple two column data.frame. | ||
##' | ||
##' @param fixReport A fixation Report as may be created by | ||
##' fixReport(). Must contain columns \code{xpos} and \code{ypos}. | ||
##' @param poiList A data.frame containing x,y coordinates for Points | ||
##' of Interest. The data.frame must contain exactly two columns, | ||
##' named \code{xpos} and \code{ypos}, in that order. | ||
##' @param supplement If TRUE, nearestPOI() will return a data.frame | ||
##' consisting of fixReport suplemented with columns nearestpoi | ||
##' and dist2poi. If FALSE return a 2 column data.frame with just | ||
##' those two columns. | ||
##' @return A data.frame including columns nearestpoi and dist2poi. | ||
##' @author Dave Braze <davebraze@@gmail.com> | ||
##' @export | ||
nearestPOI <- function (fixReport, poiList, supplement=TRUE) { | ||
f <- function(fix=fix, poiList=poiList) { | ||
## Find nearest poi for one fixation. | ||
tmp <- rbind(fix[c("xpos", "ypos")], poi) ## should merge rather than rbind | ||
dst <- as.matrix(dist(tmp))[-1,1] | ||
.nearestpoi <- which.min(dst) | ||
names(.nearestpoi) <- NULL | ||
.dist2poi <- min(dst) | ||
retval <- data.frame(nearestpoi=.nearestpoi, dist2poi=.dist2poi) | ||
} | ||
retval <- purrr::by_row(fixReport, f, poi=poi, .collate="row", | ||
.labels=supplement) | ||
select(retval, -matches("^.row$")) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.