[R] Dataframe calculations
Petr PIKAL
petr.pikal at precheza.cz
Mon Mar 22 11:50:25 CET 2010
Hi
If I understand correctly you want to add wait and travel time to first
arrive for each block of data in one day
test<-SCHEDULE2
test$ARRIVE[test$ARRIVE==0]<-NA
library(zoo)
test$ARRIVE<-na.locf(test$ARRIVE)
datumA<-paste(paste(test$MM, test$DD, test$YEAR, sep="."), test$ARRIVE,
sep=" ")
datumA<-strptime(datumA, format="%m.%d.%Y %H:%M:%S")
w<-cumsum(test$WAIT[1:4]*60)
tr<-cumsum(test$TRAVEL[1:4]*60)
arrivals <- datumA[1:4]+w+tr
departures <- datumA[1:4]+w+c(0,tr[1:3])
now you can either make a cycle in which you choose appropriate values
from your data frame or try to look at split/lapply/sapply solution. I
would try a cycle with such index
idx<-seq(1,316,4)
for (i in idx) {
wi <- cumsum(test$WAIT[i:(i+4)]*60)
tri <- cumsum(test$TRAVEL[i:(i+4)]*60)
arrivals <- datumA[i:(i+4)]+wi+tri
departures <- datumA[i:(i+4)]+wi+c(0,tri[1:3])
test$ARRIVALS [i+1:i+3] <- arrivals[1:3]
test$DEPARTURES[i:i+4] <- departures
}
untested
Regards
Petr
r-help-bounces at r-project.org napsal dne 19.03.2010 18:58:09:
> Unfortunately, that did not correct the problem. Times for 'ARRIVE' need
to be
> either 07:00:00 or 14:30:00 for the first case of each unique 'MM' by
'DD'
> subgroup (the others will be calculated), and the code produces
calculations
> that I can't interpret from the fixed numbers. Also, 'ARRIVE' and
'DEPART'
> incorrectly have the same value for the first case of each unique 'MM'
by 'DD'
> subgroup. 'DEPART' should equal 'ARRIVE' plus the 'WAIT' time in minutes
of
> the same line.
>
> Thank you,
>
> Mike
>
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
> Behalf Of Erich Neuwirth
> Sent: Friday, March 19, 2010 1:33 PM
> To: r-help at r-project.org
> Subject: Re: [R] Dataframe calculations
>
> Sorry,
> Oddly I got the use of odds and evens the wrong way round.
>
> addDelays <- function(arriveTime,waitVec,travelVec){
> start<-as.POSIXct(arriveTime,format="%H:%M:%S")
> delays<-as.vector(t(cbind(waitVec,travelVec)))
> newtimes<-format(start+cumsum(delays)*60,format="%H:%M:%S")
> list(departs=c(arriveTime,(evens(newtimes))[-1]),
> arrives=odds(newtimes))
> }
>
> Using the new definition of addDelays above should do the trick.
>
>
>
> On 3/19/2010 5:30 PM, Hosack, Michael wrote:
> > Erich,
> >
> > Thank you so much for the effort you put into writing this code.
> > I ran it and then assigned the two variables you created to the
> > 'ARRIVE' and 'DEPART' variables of my dataframe as you directed and
> > the resultant calculations were incorrect. I am not sure why it did
> > not work, I do not yet grasp the coding, I am still a novice.
> > Perhaps you or someone else could rerun your code on my original
> > dataframe and see why it did not yield the correct results.
> >
> > Thank you,
> >
> > Mike
> >
> > -----Original Message-----
> > From: r-help-bounces at r-project.org [
mailto:r-help-bounces at r-project.org] On
> Behalf Of Erich Neuwirth
> > Sent: Friday, March 19, 2010 11:38 AM
> > To: r-help at r-project.org
> > Subject: Re: [R] Dataframe calculations
> >
> > with the following code
> >
> > newvars()$ARRIVALS and newvars()$DEPARTURES
> > will give you the new variables you need.
> >
> >
> > -=-=-=
> >
> >
> > addDelays <- function(arriveTime,waitVec,travelVec){
> > start<-as.POSIXct(arriveTime,format="%H:%M:%S")
> > delays<-as.vector(t(cbind(waitVec,travelVec)))
> > newtimes<-format(start+cumsum(delays)*60,format="%H:%M:%S")
> > list(departs=c(arriveTime,(odds(newtimes))[-1]),
> > arrives=evens(newtimes))
> > }
> >
> > odds <- function(inVec){
> > indvec<-0:(floor((length(inVec)-1)/2))
> > inVec[2*indvec+1]
> > }
> >
> > evens <- function(inVec){
> > odds(inVec[-1])
> > }
> >
> >
> > newvars <- function(){
> > DATE<-with(SCHEDULE2,paste(YEAR,MM,DD,sep=""))
> > starts<-as.list(with(SCHEDULE2,tapply(ARRIVE,DATE,function(x)x[1])))
> > waits<-with(SCHEDULE2,tapply(WAIT,DATE,function(x)x))
> > travels<-with(SCHEDULE2,tapply(TRAVEL,DATE,function(x)x))
> > list(DEPARTURES=
> >
> >
as.vector(mapply(function(...)addDelays(...)$departs,starts,waits,travels)),
> > ARRIVALS=
> >
> >
as.vector(mapply(function(...)addDelays(...)$arrives,starts,waits,travels)))
> > }
> >
> >
> >
> > SCHEDULE2 <-
> > structure(list(MM = c("05", "05", "05", "05", "05", "05", "05", "05",
"05",
> "05", "05", "05", "05", "05", "05", "05", "05", "05", "05", "05", "05",
"05",
> "05", "05", "05", "05", "05", "05", "05", "05", "05", "05", "05", "05",
"05",
> "05", "05", "05", "05", "05", "05", "05", "05", "05", "05", "05", "05",
"05",
> "05", "05", "05", "05", "05", "05", "05", "05", "06", "06", "06", "06",
"06",
> "06", "06", "06", "06", "06", "06", "06", "06", "06", "06", "06", "06",
"06",
> "06", "06", "06", "06", "06", "06", "06", "06", "06", "06", "06", "06",
"06",
> "06", "06", "06", "06", "06", "06", "06", "06", "06", "06", "06", "06",
"06",
> "06", "06", "06", "06", "06", "06", "06", "06", "07", "07", "07", "07",
"07",
> "07", "07", "07", "07", "07", "07", "07", "07", "07", "07", "07", "07",
"07",
> "07", "07", "07", "07", "07", "07", "07", "07", "07", "07", "07", "07",
"07",
> "07", "07", "07", "07", "07", "07", "07", "07", "07", "07", "07", "07",
"07",
> "07", "07", "07", "07", "08", "08", "08", "08", "08",
> "!
> > 08", "08", "08", "08", "08", "08", "08", "08", "08", "08", "08",
"08",
> "08", "08", "08", "08", "08", "08", "08", "08", "08", "08", "08", "08",
"08",
> "08", "08", "08", "08", "08", "08", "08", "08", "08", "08", "08", "08",
"08",
> "08", "08", "08", "08", "08", "08", "08", "08", "08", "08", "08", "08",
"08",
> "09", "09", "09", "09", "09", "09", "09", "09", "09", "09", "09", "09",
"09",
> "09", "09", "09", "09", "09", "09", "09", "09", "09", "09", "09", "09",
"09",
> "09", "09", "09", "09", "09", "09", "09", "09", "09", "09", "09", "09",
"09",
> "09", "09", "09", "09", "09", "09", "09", "09", "09", "09", "09", "09",
"09",
> "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10",
"10",
> "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10",
"10",
> "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10",
"10",
> "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10",
"10"),
> DD = c("02", "02", "02", "02", "03", "03", "03", "03", "
> 06!
> > ", "06", "06", "06", "09", "09", "09", "09", "10", "10", "10", "10",
"
> > 14", "14", "14", "14", "16", "16", "16", "16", "17", "17", "17", "17",
"19",
> "19", "19", "19", "22", "22", "22", "22", "24", "24", "24", "24", "27",
"27",
> "27", "27", "29", "29", "29", "29", "31", "31", "31", "31", "04", "04",
"04",
> "04", "06", "06", "06", "06", "07", "07", "07", "07", "10", "10", "10",
"10",
> "12", "12", "12", "12", "16", "16", "16", "16", "17", "17", "17", "17",
"19",
> "19", "19", "19", "22", "22", "22", "22", "23", "23", "23", "23", "27",
"27",
> "27", "27", "28", "28", "28", "28", "29", "29", "29", "29", "03", "03",
"03",
> "03", "05", "05", "05", "05", "09", "09", "09", "09", "10", "10", "10",
"10",
> "13", "13", "13", "13", "14", "14", "14", "14", "18", "18", "18", "18",
"22",
> "22", "22", "22", "23", "23", "23", "23", "24", "24", "24", "24", "27",
"27",
> "27", "27", "28", "28", "28", "28", "01", "01", "01", "01", "04", "04",
"04",
> "04", "06", "06", "06", "06", "07", "07", "07", "07", "12", "12", "12",
"12",
> "13", "13", "13", "13", "14", "14", "14", "14", "16"
> , !
> > "16", "16", "16", "19", "19", "19", "19", "21", "21", "21", "21",
"23",
> "23", "23", "23", "24", "24", "24", "24", "28", "28", "28", "28", "31",
"31",
> "31", "31", "02", "02", "02", "02", "04", "04", "04", "04", "08", "08",
"08",
> "08", "09", "09", "09", "09", "11", "11", "11", "11", "14", "14", "14",
"14",
> "16", "16", "16", "16", "19", "19", "19", "19", "20", "20", "20", "20",
"21",
> "21", "21", "21", "26", "26", "26", "26", "27", "27", "27", "27", "29",
"29",
> "29", "29", "03", "03", "03", "03", "05", "05", "05", "05", "08", "08",
"08",
> "08", "10", "10", "10", "10", "14", "14", "14", "14", "15", "15", "15",
"15",
> "16", "16", "16", "16", "20", "20", "20", "20", "21", "21", "21", "21",
"24",
> "24", "24", "24", "26", "26", "26", "26", "29", "29", "29", "29", "30",
"30", "30", "30"
> > ), YEAR = c("2010", "2010", "2010", "2010", "2010", "2010", "2010",
"2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010",
> "!
> > 2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
"2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "20
> 10!
> > ", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
"20
> > 10", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
"2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010", "2010",
> "2010", "2010", "2010", "2010", "2010", "2010", "2010"), DOW = c("SUN",
"SUN",
> "SUN", "SUN", "MON", "MON", "MON", "MON", "THR", "THR", "THR", "THR",
"SUN",
> "SUN", "SUN", "SUN", "MON", "MON", "MON", "MON", "FRI", "FRI", "FRI",
"FRI",
> "SUN", "SUN", "SUN", "SUN", "MON", "MON", "MON", "MON", "WED", "WED",
"WED",
> "WED", "SAT", "SAT", "SAT", "SAT", "MON", "MON", "MON", "MON", "THR",
"THR",
> "THR", "THR", "SAT", "SAT", "SAT", "SAT", "MON", "MON", "MON", "MON",
"FRI",
> "FRI", "FRI", "FRI", "SUN", "SUN", "SUN", "SUN", "MON", "MON", "MON",
"MON", "THR", "T
> HR!
> > ", "THR", "THR", "SAT", "SAT", "SAT", "SAT", "WED", "WED", "WED",
"WED",
> "THR", "THR", "THR", "THR", "SAT", "SAT", "SAT", "SAT", "TUE", "TUE",
"TUE",
> "TUE", "WED", "WED", "WED", "WED", "SUN", "SUN", "SUN", "SUN", "MON",
"MON",
> "MON", "MON", "TUE", "TUE", "TUE", "TUE", "SAT", "SAT", "SAT", "SAT",
"MON",
> "MON", "MON", "MON", "FRI", "FRI", "FRI", "FRI", "SAT", "SAT", "SAT",
"SAT",
> "TUE", "TUE", "TUE", "TUE", "WED", "WED", "WED", "WED", "SUN", "SUN",
"SUN",
> "SUN", "THR", "THR", "THR", "THR", "FRI", "FRI", "FRI", "FRI", "SAT",
"SAT",
> "SAT", "SAT", "TUE", "TUE", "TUE", "TUE", "WED", "WED", "WED", "WED",
"SUN",
> "SUN", "SUN", "SUN", "WED", "WED", "WED", "WED", "FRI", "FRI", "FRI",
"FRI",
> "SAT", "SAT", "SAT", "SAT", "THR", "THR", "THR", "THR", "FRI", "FRI",
"FRI",
> "FRI", "SAT", "SAT", "SAT", "SAT", "MON", "MON", "MON", "MON", "THR",
"THR",
> "THR", "THR", "SAT", "SAT", "SAT", "SAT", "MON", "MON", "MON", "MON",
"TUE",
> "TUE", "TUE", "TUE", "SAT", "SAT", "SAT", "SAT", "TUE", "TUE", "TU
> E"!
> > , "TUE", "THR", "THR", "THR", "THR", "SAT", "SAT", "SAT", "SAT",
"WED"
> > , "WED", "WED", "WED", "THR", "THR", "THR", "THR", "SAT", "SAT",
"SAT",
> "SAT", "TUE", "TUE", "TUE", "TUE", "THR", "THR", "THR", "THR", "SUN",
"SUN",
> "SUN", "SUN", "MON", "MON", "MON", "MON", "TUE", "TUE", "TUE", "TUE",
"SUN",
> "SUN", "SUN", "SUN", "MON", "MON", "MON", "MON", "WED", "WED", "WED",
"WED",
> "SUN", "SUN", "SUN", "SUN", "TUE", "TUE", "TUE", "TUE", "FRI", "FRI",
"FRI",
> "FRI", "SUN", "SUN", "SUN", "SUN", "THR", "THR", "THR", "THR", "FRI",
"FRI",
> "FRI", "FRI", "SAT", "SAT", "SAT", "SAT", "WED", "WED", "WED", "WED",
"THR",
> "THR", "THR", "THR", "SUN", "SUN", "SUN", "SUN", "TUE", "TUE", "TUE",
"TUE",
> "FR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1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L,
1L,
> 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L,
2L,
> 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L,
1L,
> 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L), WEEK = c(1, 1, 1, 1, 1, 1,
1, 1,
> 1!
> > , 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
3,
> > 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5,
5, 5,
> 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7,
> 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 10,
> 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11,
11,
> 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13,
13,
> 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14,
> 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16,
16,
> 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
17,
> 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19,
19,
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1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L,
1L,
> 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L,
> 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L,
1L,
> 1L!
> > , 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
> > 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L,
2L, 2L,
> 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L,
1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
1L,
> 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L),
> > SITE1 = c(101, 102, 103, 104, 103, 104, 101, 102, 101, 102,
> > 103, 104, 101, 102, 103, 104, 103, 104, 101, 102, 103, 104,
> > 101, 102, 102, 103, 104, 101, 101, 102, 103, 104, 102, 103,
> > 104, 101, 103, 104, 101, 102, 103, 104, 101, 102, 103, 104,
> > 101, 102, 104, 101, 102, 103, 102, 103, 104, 101, 104, 101,
> > 102, 103, 101, 102, 103, 104, 104, 101, 102, 103, 103, 104,
> > 101, 102, 103, 104, 101, 102, 102, 103, 104, 101, 101, 102,
> > 103, 104, 102, 103, 104, 101, 103, 104, 101, 102, 101, 102,
> > 103, 104, 103, 104, 101, 102, 103, 104, 101, 102, 104, 101,
> > 102, 103, 103, 104, 101, 102, 101, 102, 103, 104, 101, 102,
> > 103, 104, 103, 104, 101, 102, 102, 103, 104, 101, 103, 104,
> > 101, 102, 104, 101, 102, 103, 103, 104, 101, 102, 101, 102,
> > 103, 104, 103, 104, 101, 102, 103, 104, 101, 102, 103, 104,
> > 101, 102, 101, 102, 103, 104, 104, 101, 102, 103, 101, 102,
> > 103, 104, 104, 101, 102, 103, 103, 104, 101, 102, 102, 103,
> > 104, 101, 103, 104, 101, 102, 102, 103, 104, 101, 102, 103,
> > 104, 101, 104, 101, 102, 103, 101, 102, 103, 104, 103, 104,
> > 101, 102, 103, 104, 101, 102, 102, 103, 104, 101, 101, 102,
> > 103, 104, 104, 101, 102, 103, 104, 101, 102, 103, 101, 102,
> > 103, 104, 104, 101, 102, 103, 103, 104, 101, 102, 102, 103,
> > 104, 101, 102, 103, 104, 101, 103, 104, 101, 102, 104, 101,
> > 102, 103, 101, 102, 103, 104, 103, 104, 101, 102, 104, 101,
> > 102, 103, 103, 104, 101, 102, 101, 102, 103, 104, 104, 101,
> > 102, 103, 103, 104, 101, 102, 103, 104, 101, 102, 101, 102,
> > 103, 104, 102, 103, 104, 101, 103, 104, 101, 102, 104, 101,
> > 102, 103, 103, 104, 101, 102, 101, 102, 103, 104, 104, 101,
> > 102, 103, 103, 104, 101, 102), ARRIVE = c("14:30:00", "0",
> > "0", "0", "07:00:00", "0", "0", "0", "07:00:00", "0", "0",
> > "0", "14:30:00", "0", "0", "0", "07:00:00", "0", "0", "0",
> > "07:00:00", "0", "0", "0", "07:00:00", "0", "0", "0", "07:00:00",
> > "0", "0", "0", "14:30:00", "0", "0", "0", "07:00:00", "0",
> > "0", "0", "14:30:00", "0", "0", "0", "07:00:00", "0", "0",
> > "0", "07:00:00", "0", "0", "0", "07:00:00", "0", "0", "0",
> > "14:30:00", "0", "0", "0", "07:00:00", "0", "0", "0", "14:30:00",
> > "0", "0", "0", "07:00:00", "0", "0", "0", "07:00:00", "0",
> > "0", "0", "14:30:00", "0", "0", "0", "07:00:00", "0", "0",
> > "0", "07:00:00", "0", "0", "0", "14:30:00", "0", "0", "0",
> > "07:00:00", "0", "0", "0", "07:00:00", "0", "0", "0", "07:00:00",
> > "0", "0", "0", "07:00:00", "0", "0", "0", "14:30:00", "0",
> > "0", "0", "14:30:00", "0", "0", "0", "07:00:00", "0", "0",
> > "0", "07:00:00", "0", "0", "0", "14:30:00", "0", "0", "0",
> > "14:30:00", "0", "0", "0", "07:00:00", "0", "0", "0", "07:00:00",
> > "0", "0", "0", "07:00:00", "0", "0", "0", "14:30:00", "0",
> > "0", "0", "07:00:00", "0", "0", "0", "07:00:00", "0", "0",
> > "0", "14:30:00", "0", "0", "0", "07:00:00", "0", "0", "0",
> > "14:30:00", "0", "0", "0", "14:30:00", "0", "0", "0", "07:00:00",
> > "0", "0", "0", "07:00:00", "0", "0", "0", "14:30:00", "0",
> > "0", "0", "07:00:00", "0", "0", "0", "14:30:00", "0", "0",
> > "0", "14:30:00", "0", "0", "0", "07:00:00", "0", "0", "0",
> > "07:00:00", "0", "0", "0", "07:00:00", "0", "0", "0", "14:30:00",
> > "0", "0", "0", "07:00:00", "0", "0", "0", "14:30:00", "0",
> > "0", "0", "07:00:00", "0", "0", "0", "07:00:00", "0", "0",
> > "0", "14:30:00", "0", "0", "0", "14:30:00", "0", "0", "0",
> > "14:30:00", "0", "0", "0", "14:30:00", "0", "0", "0", "14:30:00",
> > "0", "0", "0", "07:00:00", "0", "0", "0", "07:00:00", "0",
> > "0", "0", "07:00:00", "0", "0", "0", "14:30:00", "0", "0",
> > "0", "14:30:00", "0", "0", "0", "14:30:00", "0", "0", "0",
> > "14:30:00", "0", "0", "0", "07:00:00", "0", "0", "0", "07:00:00",
> > "0", "0", "0", "07:00:00", "0", "0", "0", "14:30:00", "0",
> > "0", "0", "07:00:00", "0", "0", "0", "14:30:00", "0", "0",
> > "0", "07:00:00", "0", "0", "0", "14:30:00", "0", "0", "0",
> > "07:00:00", "0", "0", "0", "14:30:00", "0", "0", "0"), WAIT =
c(100,
> > 60, 60, 100, 60, 100, 100, 60, 100, 60, 60, 100, 100, 60,
> > 60, 100, 60, 100, 100, 60, 60, 100, 100, 60, 60, 60, 100,
> > 100, 100, 60, 60, 100, 60, 60, 100, 100, 60, 100, 100, 60,
> > 60, 100, 100, 60, 60, 100, 100, 60, 100, 100, 60, 60, 60,
> > 60, 100, 100, 100, 100, 60, 60, 100, 60, 60, 100, 100, 100,
> > 60, 60, 60, 100, 100, 60, 60, 100, 100, 60, 60, 60, 100,
> > 100, 100, 60, 60, 100, 60, 60, 100, 100, 60, 100, 100, 60,
> > 100, 60, 60, 100, 60, 100, 100, 60, 60, 100, 100, 60, 100,
> > 100, 60, 60, 60, 100, 100, 60, 100, 60, 60, 100, 100, 60,
> > 60, 100, 60, 100, 100, 60, 60, 60, 100, 100, 60, 100, 100,
> > 60, 100, 100, 60, 60, 60, 100, 100, 60, 100, 60, 60, 100,
> > 60, 100, 100, 60, 60, 100, 100, 60, 60, 100, 100, 60, 100,
> > 60, 60, 100, 100, 100, 60, 60, 100, 60, 60, 100, 100, 100,
> > 60, 60, 60, 100, 100, 60, 60, 60, 100, 100, 60, 100, 100,
> > 60, 60, 60, 100, 100, 60, 60, 100, 100, 100, 100, 60, 60,
> > 100, 60, 60, 100, 60, 100, 100, 60, 60, 100, 100, 60, 60,
> > 60, 100, 100, 100, 60, 60, 100, 100, 100, 60, 60, 100, 100,
> > 60, 60, 100, 60, 60, 100, 100, 100, 60, 60, 60, 100, 100,
> > 60, 60, 60, 100, 100, 60, 60, 100, 100, 60, 100, 100, 60,
> > 100, 100, 60, 60, 100, 60, 60, 100, 60, 100, 100, 60, 100,
> > 100, 60, 60, 60, 100, 100, 60, 100, 60, 60, 100, 100, 100,
> > 60, 60, 60, 100, 100, 60, 60, 100, 100, 60, 100, 60, 60,
> > 100, 60, 60, 100, 100, 60, 100, 100, 60, 100, 100, 60, 60,
> > 60, 100, 100, 60, 100, 60, 60, 100, 100, 100, 60, 60, 60,
> > 100, 100, 60), DEPART = c("16:10:00", "0", "0", "0", "08:00:00",
> > "0", "0", "0", "08:40:00", "0", "0", "0", "16:10:00", "0",
> > "0", "0", "08:00:00", "0", "0", "0", "08:00:00", "0", "0",
> > "0", "08:00:00", "0", "0", "0", "08:40:00", "0", "0", "0",
> > "15:30:00", "0", "0", "0", "08:00:00", "0", "0", "0", "15:30:00",
> > "0", "0", "0", "08:00:00", "0", "0", "0", "08:40:00", "0",
> > "0", "0", "08:00:00", "0", "0", "0", "16:10:00", "0", "0",
> > "0", "08:40:00", "0", "0", "0", "16:10:00", "0", "0", "0",
> > "08:00:00", "0", "0", "0", "08:00:00", "0", "0", "0", "15:30:00",
> > "0", "0", "0", "08:40:00", "0", "0", "0", "08:00:00", "0",
> > "0", "0", "15:30:00", "0", "0", "0", "08:40:00", "0", "0",
> > "0", "08:00:00", "0", "0", "0", "08:00:00", "0", "0", "0",
> > "08:40:00", "0", "0", "0", "15:30:00", "0", "0", "0", "16:10:00",
> > "0", "0", "0", "08:40:00", "0", "0", "0", "08:00:00", "0",
> > "0", "0", "15:30:00", "0", "0", "0", "15:30:00", "0", "0",
> > "0", "08:40:00", "0", "0", "0", "08:00:00", "0", "0", "0",
> > "08:40:00", "0", "0", "0", "15:30:00", "0", "0", "0", "08:00:00",
> > "0", "0", "0", "08:00:00", "0", "0", "0", "16:10:00", "0",
> > "0", "0", "08:40:00", "0", "0", "0", "16:10:00", "0", "0",
> > "0", "16:10:00", "0", "0", "0", "08:00:00", "0", "0", "0",
> > "08:00:00", "0", "0", "0", "15:30:00", "0", "0", "0", "08:00:00",
> > "0", "0", "0", "15:30:00", "0", "0", "0", "16:10:00", "0",
> > "0", "0", "08:40:00", "0", "0", "0", "08:00:00", "0", "0",
> > "0", "08:00:00", "0", "0", "0", "15:30:00", "0", "0", "0",
> > "08:40:00", "0", "0", "0", "16:10:00", "0", "0", "0", "08:40:00",
> > "0", "0", "0", "08:40:00", "0", "0", "0", "16:10:00", "0",
> > "0", "0", "15:30:00", "0", "0", "0", "15:30:00", "0", "0",
> > "0", "15:30:00", "0", "0", "0", "15:30:00", "0", "0", "0",
> > "08:40:00", "0", "0", "0", "08:40:00", "0", "0", "0", "08:00:00",
> > "0", "0", "0", "16:10:00", "0", "0", "0", "15:30:00", "0",
> > "0", "0", "16:10:00", "0", "0", "0", "16:10:00", "0", "0",
> > "0", "08:00:00", "0", "0", "0", "08:00:00", "0", "0", "0",
> > "08:40:00", "0", "0", "0", "15:30:00", "0", "0", "0", "08:00:00",
> > "0", "0", "0", "16:10:00", "0", "0", "0", "08:00:00", "0",
> > "0", "0", "16:10:00", "0", "0", "0", "08:40:00", "0", "0",
> > "0", "15:30:00", "0", "0", "0"), TRAVEL = c(30, 10, 35, 50,
> > 35, 50, 30, 10, 30, 10, 35, 50, 30, 10, 35, 50, 35, 50, 30,
> > 10, 35, 50, 30, 10, 10, 35, 50, 30, 30, 10, 35, 50, 10, 35,
> > 50, 30, 35, 50, 30, 10, 35, 50, 30, 10, 35, 50, 30, 10, 50,
> > 30, 10, 35, 10, 35, 50, 30, 50, 30, 10, 35, 30, 10, 35, 50,
> > 50, 30, 10, 35, 35, 50, 30, 10, 35, 50, 30, 10, 10, 35, 50,
> > 30, 30, 10, 35, 50, 10, 35, 50, 30, 35, 50, 30, 10, 30, 10,
> > 35, 50, 35, 50, 30, 10, 35, 50, 30, 10, 50, 30, 10, 35, 35,
> > 50, 30, 10, 30, 10, 35, 50, 30, 10, 35, 50, 35, 50, 30, 10,
> > 10, 35, 50, 30, 35, 50, 30, 10, 50, 30, 10, 35, 35, 50, 30,
> > 10, 30, 10, 35, 50, 35, 50, 30, 10, 35, 50, 30, 10, 35, 50,
> > 30, 10, 30, 10, 35, 50, 50, 30, 10, 35, 30, 10, 35, 50, 50,
> > 30, 10, 35, 35, 50, 30, 10, 10, 35, 50, 30, 35, 50, 30, 10,
> > 10, 35, 50, 30, 10, 35, 50, 30, 50, 30, 10, 35, 30, 10, 35,
> > 50, 35, 50, 30, 10, 35, 50, 30, 10, 10, 35, 50, 30, 30, 10,
> > 35, 50, 50, 30, 10, 35, 50, 30, 10, 35, 30, 10, 35, 50, 50,
> > 30, 10, 35, 35, 50, 30, 10, 10, 35, 50, 30, 10, 35, 50, 30,
> > 35, 50, 30, 10, 50, 30, 10, 35, 30, 10, 35, 50, 35, 50, 30,
> > 10, 50, 30, 10, 35, 35, 50, 30, 10, 30, 10, 35, 50, 50, 30,
> > 10, 35, 35, 50, 30, 10, 35, 50, 30, 10, 30, 10, 35, 50, 10,
> > 35, 50, 30, 35, 50, 30, 10, 50, 30, 10, 35, 35, 50, 30, 10,
> > 30, 10, 35, 50, 50, 30, 10, 35, 35, 50, 30, 10)), .Names = c("MM",
"DD",
> "YEAR", "DOW", "DTYPE", "WEEK", "TOD", "SITE1", "ARRIVE", "WAIT",
"DEPART",
> "TRAVEL"), row.names = c("53", "531", "532", "533", "2", "210", "212",
"214",
> "1", "110", "112", "114", "54", "541", "542", "543", "3", "310", "312",
"314",
> "4", "410", "412", "414", "55", "551", "552", "553", "5", "510", "512",
"514",
> "6", "610", "612", "614", "56", "561", "562", "563", "7", "710", "712",
"714",
> "8", "81", "82", "83", "57", "571", "572", "573", "9", "91", "92", "93",
"10",
> "101", "102", "103", "58", "581", "582", "583", "12", "121", "122",
"123",
> "11", "111", "113", "115", "59", "591", "592", "593", "14", "141",
"142",
> "143", "13", "131", "132", "133", "60", "601", "602", "603", "16",
"161",
> "162", "163", "15", "151", "152", "153", "61", "611", "613", "615",
"18",
> "181", "182", "183", "17", "171", "172", "173", "62", "621", "622",
"623",
> "19", "191", "192", "193", "20", "201", "202", "203", "63", "631", "
> 63!
> > 2", "633", "22", "221", "222", "223", "21", "211", "213", "215",
"64",
> "641", "642", "643", "24", "241", "242", "243", "23", "231", "232",
"233",
> "65", "651", "652", "653", "26", "261", "262", "263", "25", "251",
"252",
> "253", "66", "661", "662", "663", "28", "281", "282", "283", "27",
"271",
> "272", "273", "67", "671", "672", "673", "30", "301", "302", "303",
"29",
> "291", "292", "293", "68", "681", "682", "683", "32", "321", "322",
"323",
> "31", "311", "313", "315", "69", "691", "692", "693", "33", "331",
"332",
> "333", "34", "341", "342", "343", "70", "701", "702", "703", "35",
"351",
> "352", "353", "36", "361", "362", "363", "71", "711", "713", "715",
"38",
> "381", "382", "383", "37", "371", "372", "373", "72", "721", "722",
"723",
> "40", "401", "402", "403", "39", "391", "392", "393", "73", "731",
"732",
> "733", "42", "421", "422", "423", "41", "411", "413", "415", "74",
"741",
> "742", "743", "43", "431", "432", "433", "44", "441", "442", "443",
"75",
> "751", "752", "753", "45
> ",!
> > "451", "452", "453", "46", "461", "462", "463", "76", "761", "762",
"
> > 763", "48", "481", "482", "483", "47", "471", "472", "473", "77",
"771",
> "772", "773", "49", "491", "492", "493", "50", "501", "502", "503",
"78",
> "781", "782", "783", "52", "521", "522", "523", "51", "511", "513",
"515",
> "79", "791", "792", "793"), class = "data.frame")
> >
> > --
> > Erich Neuwirth, University of Vienna
> > Faculty of Computer Science
> > Computer Supported Didactics Working Group
> > Visit our SunSITE at http://sunsite.univie.ac.at
> > Phone: +43-1-4277-39464 Fax: +43-1-4277-39459
> >
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
> >
>
> --
> Erich Neuwirth, University of Vienna
> Faculty of Computer Science
> Computer Supported Didactics Working Group
> Visit our SunSITE at http://sunsite.univie.ac.at
> Phone: +43-1-4277-39464 Fax: +43-1-4277-39459
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list