@@ -7,43 +7,43 @@ fieldnames <- c("EVA #", "Country", "Crew ", "Vehicle", "Date", "Duration", "
77library(jsonlite )
88
99j_l <- read_json(data_f_file )
10- data = as.data.frame(j_l [[1 ]])
10+ data <- as.data.frame(j_l [[1 ]])
1111
1212for ( i in 2 : 374 ){
13- r = j_l [[i ]]
13+ r <- j_l [[i ]]
1414 print(r )
15- data = merge(data , as.data.frame(r ), all = TRUE )
15+ data <- merge(data , as.data.frame(r ), all = TRUE )
1616}
1717# data.pop(0)
1818
1919time <- c()
20- date = Date()
20+ date <- as. Date(character () )
2121
2222library(lubridate )
23- j = 1
23+ j <- 1
2424for (i in rownames(data )){
2525 print(data [j , ])
2626 if (! is.na(data [j ,]$ duration )){
27- tt = data [j ,]$ duration
27+ tt <- data [j ,]$ duration
2828 if (tt == ' ' ){
2929 # do nothing
3030 }else {
31- t = as.POSIXlt(tt ,format = ' %H:%M' )
31+ t <- as.POSIXlt(tt ,format = ' %H:%M' )
3232 ttt <- as.numeric(as.difftime(hour(t ), units = ' hours' )+ as.difftime(minute(t ), units = ' mins' )+ as.difftime(second(t ), units = ' secs' ))/ (60 * 60 )
3333 print(t ,ttt )
3434 time <- c(time , ttt )
3535 if (! is.na(data [j ,]$ date )){
36- date = c(date , as.Date(substr(data [j ,' date' ], 1 , 10 ), format = ' %Y-%m-%d' ))
36+ date <- c(date , as.Date(substr(data [j ,' date' ], 1 , 10 ), format = ' %Y-%m-%d' ))
3737
3838 }else {
3939 time <- time [1 : length(time ) - 1 ]
4040 }
4141 }
4242 }
43- j = j + 1
43+ j <- j + 1
4444}
4545
46- t = 0
46+ t <- 0
4747for (i in time )
4848 t <- c(t , t [length(t )]+ i )
4949
0 commit comments