Hi there,
Could someone guide me on how to create a list with 50 slots and in each slot create a list with two elements:
- name of "n1, n2, ...n50"
- vector of 5 elements from a normal distribution with mean = 23 and standard dev = 5
Thanks in advance.
Hi there,
Could someone guide me on how to create a list with 50 slots and in each slot create a list with two elements:
Hello and welcome to the forum.
My first question is, is this homework?
Yes it is.
Shall I let you know the code I've typed so far?
yes, please do that Harini
Sure,
mybiglist <- list()
for(i in 1:100){
a <- list(1:100,i)
b <- rnorm(5, 23, 5)
name <- paste('Item:',i,sep='')
tmp <- list(Name=a, Vector=b)
mybiglist[[name]] <- tmp
}
print(mybiglist)
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.