Comments (1)
my idea
library(data.table)
library(magrittr)
# data
dt <- c("00:00:01","01:34:15","03:40:29","05:25:44","07:40:58","08:49:12",
"10:31:26","12:19:40","14:21:55","15:42:09","17:22:23","19:27:37",
"21:20:52","22:08:06","00:33:20","00:38:25") %>% data.table::as.ITime()
# analysis
aux <- as.numeric(dt)
aux1 <- shift(aux,n = 1, fill = 0,type = "lag")
diff <- aux - aux1 # difference
diff
#> [1] 1 5654 7574 6315 8114 4094 6134 6494 7335 4814
#> [11] 6014 7514 6795 2834 -77686 305
# from position in which diff is negative until the last position
mod <- which(diff < 0):length(diff)
mod
#> [1] 15 16
# add one day (86400 s)
dt[mod] = 86400 + dt[mod]
dt
#> [1] "00:00:01" "01:34:15" "03:40:29" "05:25:44" "07:40:58" "08:49:12"
#> [7] "10:31:26" "12:19:40" "14:21:55" "15:42:09" "17:22:23" "19:27:37"
#> [13] "21:20:52" "22:08:06" "24:33:20" "24:38:25"
dt <- as.numeric(dt)
dt
#> [1] 1 5655 13229 19544 27658 31752 37886 44380 51715 56529 62543 70057
#> [13] 76852 79686 88400 88705
Created on 2020-05-14 by the reprex package (v0.3.0)
from gtfs2gps.
Related Issues (20)
- should gtfs2gps includes as gtfs class, such as gtfstools? HOT 9
- gtfs2gps::gtfs2gps not processing transport network sf object HOT 4
- example of adjust_speed function not working HOT 1
- writing a merged gtfs list got: 'gtfs' must inherit from the 'gtfs' class HOT 2
- gtfs2gps::gtfs2gps function not exporting file with proper units
- incompatibility with gtfstools HOT 1
- Vignette link does not work HOT 1
- Check performance of using gtfstools::string_to_seconds() HOT 2
- adjust_speed approach HOT 2
- Add `progress` parameter to gtfs2gps HOT 1
- New silent parameter to gtfs2gps()
- gtfs2gps function changing input parameter by reference HOT 1
- 'speed' values are NA , but not really HOT 3
- problems with spatial_resolution input argument
- Submit v2.1-0 to CRAN
- Add new parameter ncores
- passar apend_height p/ gtfs2emis
- fix documentation of parameter `ncores`
- Issues with the upcoming release of units 0.8-2 HOT 1
- Reactivate codecov
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gtfs2gps.