亲爱的,
我是R编程的新手,因此,我来这里是为了寻求帮助。我试图找到解决这个问题的方法。我一直努力但没有成功。
我有一个类似的数据框...
df2 <- data.frame(Recordig = c("Rec1", "Rec1", "Rec1", "Rec1", "Rec1", "Rec1",
"Rec2","Rec2","Rec2","Rec2","Rec2","Rec2"),
MediaName = c("Imagem1","Imagem1","Imagem1",
"Estimulo1","Estimulo1","Estimulo1",
"Imagem1","Imagem1","Imagem1",
"Estimulo1","Estimulo1","Estimulo1"),
Timestamp = c( 4975 , 5155 , 5312 ,25076, 25463 ,26040 , 5035 , 5248, 5551, 17047 , 17263, 17533))
以下简化版
Recordig MediaName Timestamp
1 Rec1 Imagem1 4975
2 Rec1 Imagem1 5155
3 Rec1 Imagem1 5312
4 Rec1 Estimulo1 25076
5 Rec1 Estimulo1 25463
6 Rec1 Estimulo1 26040
7 Rec2 Imagem1 5035
8 Rec2 Imagem1 5248
9 Rec2 Imagem1 5551
10 Rec2 Estimulo1 17047
11 Rec2 Estimulo1 17263
12 Rec2 Estimulo1 17533
我的观点是什么?我需要准确知道参与者(例如Rec1)花多少时间查看每个图像(Image1)。在这种情况下,Image1的时间戳开始于4.975秒,结束时为5.312秒,给出333毫秒
关键是我有数百张图片和数千名受访者花了不同时间观察图像。
有人有想法帮助我吗?
答案 0 :(得分:0)
您可以使用MediaName
包找到每个参与者(dplyr
)和图片(library(dplyr)
df3 <- df2 %>%
dplyr::group_by(Recordig, MediaName) %>%
dplyr::summarise(duration = diff(range(Timestamp)))
df3
# Source: local data frame [4 x 3]
# Groups: Recordig [?]
#
# Recordig MediaName duration
# <fctr> <fctr> <dbl>
# 1 Rec1 Estimulo1 964
# 2 Rec1 Imagem1 337
# 3 Rec2 Estimulo1 486
# 4 Rec2 Imagem1 516
)的第一个和最后一个时间戳之间的差异:
List A
foreach x in A { variable b = x; => then some operation => print result}
答案 1 :(得分:0)
我们可以使用 function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 17,
clickableIcons: false,
center: {lat: 34.04924594193164, lng: -118.24104309082031}
});
var myMarker = new google.maps.Marker({
position: {lat: 34.04924594193164, lng: -118.24104309082031},
map: map,
title: 'myMarker',
draggable: false
});
var trafficLayer = new google.maps.TrafficLayer();
trafficLayer.setMap(map);
}
base R