Dear Bill,

thank you for your help. I think, I finally understood your advice. At least, 
this one worked:

library(package = lubridate)   # for a more convenient display of times

i <- 12   # number of time intervals per hour

# creating a data.frame (original example)
business_hours <- data.frame(t = hm(paste(rep(x = 0:23, each = i), rep(x = 
seq(from = 0, to = 60/i * (i - 1), by = 60/i), times = 24))),
                             A = c(rep(x = 0, times = (8 - (1/i)) * i), 1, 
rep(x = 0, times = (12   - (1/i)) * i), -1, rep(x = 0, times = (4           ) * 
i)),
                             B = c(rep(x = 0, times = (9 - (1/i)) * i), 1, 
rep(x = 0, times = (2.75 - (1/i)) * i), -1, rep(x = 0, times = (1.75 - (1/i)) * 
i), 1, rep(x = 0, times = (3.5 - (1/i)) * i), -1, rep(x = 0, times = 7 * i)))

# some data analysis
plot(x = rowSums(x = cumsum(business_hours[, -1])), type = "s")

I find some elegance in this solution; still, Jims proposal looks easier to 
handle to me.

Best regards,

Alex


--
Alexander Sommer
wissenschaftlicher Mitarbeiter

Technische Universität Dortmund
Fakultät Erziehungswissenschaft, Psychologie und Soziologie
Forschungsverbund Deutsches Jugendinstitut/Technische Universität Dortmund
Vogelpothsweg 78
44227 Dortmund

Telefon: +49 231 755-8189
Telefax: +49 231 755-6553
E-Mail:  alexander.som...@tu-dortmund.de
WWW:     http://www.forschungsverbund.tu-dortmund.de/
Wichtiger Hinweis: Die Information in dieser E-Mail ist vertraulich. Sie ist 
ausschließlich für den Adressaten bestimmt. Sollten Sie nicht der für diese 
E-Mail bestimmte Adressat sein, unterrichten Sie bitte den Absender und 
vernichten Sie diese Mail. Vielen Dank.
Unbeschadet der Korrespondenz per E-Mail, sind unsere Erklärungen 
ausschließlich final rechtsverbindlich, wenn sie in herkömmlicher Schriftform 
(mit eigenhändiger Unterschrift) oder durch Übermittlung eines solchen 
Schriftstücks per Telefax erfolgen.

Important note: The information included in this e-mail is confidential. It is 
solely intended for the recipient. If you are not the intended recipient of 
this e-mail please contact the sender and delete this message. Thank you. 
Without prejudice of e-mail correspondence, our statements are only legally 
binding when they are made in the conventional written form (with personal 
signature) or when such documents are sent by fax.
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to