2

'eyetrackingR' 包似乎很有希望用于分析眼动追踪数据,但我在尝试以适当格式获取数据时遇到了问题。

感兴趣区域 (aoi) 设置有左、右、下和上边界,我想评估任何试验的 xy 坐标是否落在给定区域内。该区域因参与者而异(基于他们的屏幕分辨率),但在试验中保持不变。我试图在下面的第一步中尽可能地简化数据。

在这里,我创建了两个数据框。一个是原始眼球追踪数据,在“gaze_x”和“gaze_y”列中具有估计的眼睛位置。两个是 aoi 数据集,稍后用作“add_aoi”函数的输入,用于评估估计的位置是否在指定区域内。

library(eyetrackingR)

datRep <- data.frame(
  stringsAsFactors = FALSE,
  res_x = c(1920L,1920L,1920L),
  res_y = c(969L,969L,969L),
  mid_x = c(960L,960L,960L),
  mid_y = c(484.5,484.5,484.5),
  gaze_x = c(1103.6,1103.6,1103.6),
  gaze_y = c(525.8,525.8,525.8),
  cond = c("fixation","image display","response"),
  pair = c(3L, 3L, 3L),
  trial_time = c(0.00105,0.00105,0.02798),
  selection = c(NA, NA, "right")
)

aoi_left <- data.frame(
  Trial = c(3L,2L, 1L),
  Left = c(0L,0L,0L),
  Right = c(960L,960L,960L),
  Top = c(969L,969L,969L),
  Bottom = c(0L,0L,0L)
)

现在已经指定了样本数据集和感兴趣的区域,我想将后者添加到前者。这是根据此处提供的示例完成的:http ://www.eyetracking-r.com/vignettes/preparing_your_data 。

datRepAoi <- add_aoi(data = datRep, aoi_dataframe = aoi_left,
                     x_col = "gaze_x", y_col = "gaze_y",
                     aoi_name = "aoi_left",
                     x_min_col = "Left", x_max_col = "Right",
                     y_min_col = "Bottom", y_max_col = "Top")

#> Error in add_aoi(data = datRep, aoi_dataframe = aoi_left, x_col = "gaze_x", : 
Your `aoi_dataframe` has more than one row, but it doesn't have any columns that match the
columns in your data, so it's not clear how to map these rows onto this data.

reprex 包于 2021-04-23 创建 (v2.0.0 )

即使眼动追踪数据框的列名与 aoi 数据框的列名相同,此错误仍然存​​在。任何关于如何解决这个问题的想法都非常感谢!

4

1 回答 1

0

事实证明,aoi 数据框的试验列需要对应于原始数据集中的试验列(即“试验”)。aoi 数据框的任何其他列(例如左、右...)都不是这种情况。

于 2021-04-24T05:05:28.680 回答