@ParindDhillon wrote:
Dataset 1 - Contains driver_id & its location every few minutes
Dataset 2- driver_id & timestamp when ride request sent to driverNow i need to figure out whether driver was stationary or moving when ride request was sent to driver using R code. We can find put distance covered using lat long of drivers few minutes before request sent to driver, based on this distance covered, we can say whether driver stationary or moving. Please help me to figure it out this using fast R code as I have large data for this activity.
here is reproducible code
structure(list(driver_id = c(69L, 69L, 69L, 69L, 69L, 69L, 69L,
69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L,
69L, 69L, 69L, 69L, 69L, 69L, 550L, 550L, 550L, 550L, 550L, 550L,
550L, 550L, 550L, 550L, 550L, 550L, 550L, 550L, 550L, 550L, 550L,
550L, 550L, 550L, 550L, 550L, 550L, 550L), request_received_on = structure(c(1470814407,
1470816850, 1470817800, 1470820239, 1470820720, 1470823193, 1470824149,
1470826619, 1470826663, 1470827003, 1470829546, 1470891953, 1470896015,
1470900588, 1470905434, 1470911031, 1470911110, 1470911383, 1470911964,
1470915180, 1470915702, 1470916222, 1470994408, 1471006570, 1471156165,
1471328693, 1470801415, 1470801426, 1470806833, 1470827733, 1470828963,
1470828990, 1470829317, 1470830431, 1470830988, 1470833134, 1470833658,
1470835285, 1470835757, 1470835975, 1470838125, 1470838125, 1470838127,
1470838170, 1470838221, 1470838245, 1470838284, 1470838336, 1470838407,
1470838651), class = c("POSIXct", "POSIXt"))), .Names = c("driver_id",
"request_received_on"), row.names = c(NA, 50L), class = "data.frame")Second dataset
structure(list(driver_id = c(69L, 69L, 69L, 69L, 69L, 69L, 69L,
69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L,
69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L,
69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L,
69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L,
69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L,
69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L,
69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L,
69L, 69L, 69L, 69L, 69L), latitude = c(30.715123, 30.716708,
30.716859, 30.716729, 30.716851, 30.716774, 30.715123, 30.726547,
30.715123, 30.715123, 30.716937, 30.716937, 30.732711, 30.735893,
30.741283, 30.759516, 30.759516, 30.755983, 30.754479, 30.752912,
30.751816, 30.750664, 30.750349, 30.750143, 30.751136, 30.752486,
30.752043, 30.751776, 30.751268, 30.751029, 30.750853, 30.759862,
30.759577, 30.760126, 30.760316, 30.760292, 30.761194, 30.762052,
30.763483, 30.765106, 30.764309, 30.766647, 30.768649, 30.768845,
30.768904, 30.768758, 30.707159, 30.706041, 30.707481, 30.707353,
30.706999, 30.707643, 30.707643, 30.707624, 30.706589, 30.707586,
30.707586, 30.707586, 30.707586, 30.707125, 30.707586, 30.707517,
30.707521, 30.707481, 30.706459, 30.707621, 30.707706, 30.707714,
30.707552, 30.716923, 30.716384, 30.716336, 30.716307, 30.716307,
30.716307, 30.716307, 30.715832, 30.715306, 30.713667, 30.71103,
30.70951, 30.70951, 30.709467, 30.70888, 30.709609, 30.710366,
30.710366, 30.711592, 30.711536, 30.711592, 30.711592, 30.736862,
30.737388, 30.737145, 30.737128, 30.735885, 30.733567, 30.732792,
30.734298, 30.73431, 30.735217, 30.735882, 30.735472), longitude = c(76.743971,
76.742837, 76.74263, 76.74254, 76.7425, 76.742483, 76.743971,
76.749654, 76.743971, 76.743971, 76.744472, 76.744472, 76.762324,
76.767554, 76.776862, 76.797719, 76.797719, 76.800705, 76.79832,
76.795748, 76.794051, 76.792205, 76.79171, 76.791357, 76.789889,
76.788, 76.787264, 76.7868, 76.785829, 76.785063, 76.784956,
76.785219, 76.783172, 76.782922, 76.78274, 76.782715, 76.782078,
76.781669, 76.784356, 76.787415, 76.78593, 76.790408, 76.791403,
76.791404, 76.791419, 76.791411, 76.800794, 76.800017, 76.799108,
76.800474, 76.80052, 76.800325, 76.800325, 76.800321, 76.80018,
76.800347, 76.800347, 76.800347, 76.800347, 76.800516, 76.800347,
76.800709, 76.800337, 76.799108, 76.800241, 76.800341, 76.800268,
76.8003, 76.800327, 76.776939, 76.77755, 76.77749, 76.77743,
76.77743, 76.77743, 76.77743, 76.777896, 76.778149, 76.779539,
76.781988, 76.783462, 76.783462, 76.783529, 76.783914, 76.783168,
76.782423, 76.782423, 76.781276, 76.781349, 76.781276, 76.781276,
76.762052, 76.763581, 76.762497, 76.763436, 76.760762, 76.762551,
76.763191, 76.761839, 76.759492, 76.758485, 76.75745, 76.756833
), dateTime = structure(c(1470814081, 1470814230, 1470814329,
1470814465, 1470814624, 1470814802, 1470815068, 1470815217, 1470815360,
1470815583, 1470815584, 1470815883, 1470815884, 1470816011, 1470816146,
1470816747, 1470816785, 1470816903, 1470816938, 1470816969, 1470816986,
1470817004, 1470817021, 1470817056, 1470817085, 1470817114, 1470817130,
1470817146, 1470817179, 1470817223, 1470817224, 1470817697, 1470817806,
1470817830, 1470817874, 1470817874, 1470817893, 1470817925, 1470817990,
1470817993, 1470817999, 1470818022, 1470818060, 1470818076, 1470818122,
1470818137, 1470819115, 1470819246, 1470819382, 1470819611, 1470819739,
1470819957, 1470820079, 1470820203, 1470820693, 1470820725, 1470820763,
1470820786, 1470820816, 1470820843, 1470820859, 1470820903, 1470820919,
1470820957, 1470820986, 1470821005, 1470821037, 1470821054, 1470821071,
1470821776, 1470821872, 1470821902, 1470821932, 1470821948, 1470822015,
1470822019, 1470822041, 1470822057, 1470822089, 1470822123, 1470822152,
1470822171, 1470822201, 1470822233, 1470822262, 1470822293, 1470822411,
1470822442, 1470822442, 1470822445, 1470822466, 1470823090, 1470823198,
1470823249, 1470823253, 1470823285, 1470823314, 1470823346, 1470823378,
1470823408, 1470823427, 1470823444, 1470823476), class = c("POSIXct",
"POSIXt"), tzone = "")), .Names = c("driver_id", "latitude",
"longitude", "dateTime"), class = c("data.table", "data.frame"
), row.names = c(NA, -103L), .internal.selfref = )
Posts: 1
Participants: 1