Here is an example list of data.  You would access it by:

x[[day]][[hour]]

instead of how you mentioned in your email.

> # create a list of 3 days and 3 hours to show how the list would look
> set.seed(1)
> x <- vector('list', 3)  # top level is day
> for (day in 1:3){
+     for (hour in 1:3){  # create list of random lengths
+         x[[day]][[hour]] <- list(floor(runif(runif(1, 1, 10), 1, 20)))
+     }
+ }
> # output the list as you might have constructed it
> dput(x)
list(list(list(c(8, 11, 18)), list(c(18, 18)), list(c(12, 2,
4, 4, 14, 8))), list(list(c(10, 14, 19, 8, 15, 18, 5)), list(
    c(3, 6, 8, 1, 8, 17)), list(c(10, 12, 10, 4))), list(list(
    c(13, 16, 3, 14, 8, 16, 13, 15)), list(c(11, 15, 1, 10, 14
)), list(c(10, 17, 9, 5, 2, 2, 7))))
>
> #access the 2nd day, third hour
> x[[2]][[3]]
[[1]]
[1] 10 12 10  4



On Sat, May 8, 2010 at 2:24 AM, Remi SoftR <remir...@gmail.com> wrote:

> Dear all,
>
> d, d=1,...,10 is a day, h, h=1,...,24 is an hour and tt_dh(1),tt_dh(2),...
> is the arrival time of the 1st, 2nd etc client on day d during hour h. How
> can I make a double-indexed list ldh (indices are d and h) such that
> ldh[[d,h]] gives me arrival times?
>
> Many thanks,
> Remi
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to