Skip to content
Back to formatted view

Raw Message

Message-ID: <248BA33BC59279499C246B6EB309AF21016C9315DC@ex2010mbx1.tu-dortmund.de>
Date: 2016-08-29T13:34:49Z
From: alexander.sommer at tu-dortmund.de
Subject: Storing business hours
In-Reply-To: <CA+8X3fVpNS73BLDX2qzED3Z3VCyV4V3e3WCuKpTZHBP1EKe2Eg@mail.gmail.com>

Cheers Jim!

The 0/1 way seems to work for me. It looks like:

n <-  5   # number of ?shops?
i <- 12   # number of time intervals per hour

# creating a data.frame (the example got random values)
business_hours <- data.frame(1:n, matrix(data = sample(x = c(TRUE, FALSE), size = n * (24 * i), replace = TRUE), ncol = 24 * i))
# column names as the times
colnames(x = business_hours) <- c("Id", paste0("t", sprintf(fmt = "%02d", rep(x = 0:23, each = i)), sprintf(fmt = "%02d", rep(x = seq(from = 0, to = 60/i * (i - 1), by = 60/i), times = 24))))

# some data analysis
plot(x = colSums(x = business_hours[, -1]), type = "s")  # looks odd due to the random assignment of open/closed
summary(object = rowSums(x = business_hours[, -1])/i)    # summary of business duration in hours

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.sommer at 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.