Re: [R] R's list data structure

2012-02-17 Thread Bert Gunter
FWIW: Lists are a fundamental, universal, recursive data structure. All other data structures (i.e. r.e. sets) can be represented as lists. Indeed, one of the earliest "high level" (non-machine instructions) computer languages, McCarthy's LISP = List Processing, is based on lists. R was designed t

Re: [R] R's list data structure

2012-02-17 Thread Sarah Goslee
On Fri, Feb 17, 2012 at 3:37 PM, Ajay Askoolum wrote: > Hi Sarah, > >     Thanks you for the clarifications; I had worked round the > problem by switching to a data.frame. > >     However, I am still unclear about 'list': as it exists, it must > have a purpose. When is the use of t

Re: [R] R's list data structure

2012-02-17 Thread Ajay Askoolum
Hi Sarah,     Thanks you for the clarifications; I had worked round the problem by switching to a data.frame.     However, I am still unclear about 'list': as it exists, it must have a purpose. When is the use of the list data structure appropriate? [[alternative HTML v

Re: [R] R's list data structure

2012-02-17 Thread Sarah Goslee
HI Ajay, On Fri, Feb 17, 2012 at 3:20 PM, Ajay Askoolum wrote: > Given > > dayOfWeekName<-c("Mon","Tue","Wed","Thu","Fri","Sat","Sun"); > dayOfWeekOrdinal<-c(1,2,3,4,5,6,0); > dayOfWeekWorkDay<-c(TRUE,TRUE,TRUE,TRUE,TRUE,FALSE,FALSE); > > weekProfile<-list(dow=dayOfWeekName,dowI=dayOfWeekOrdinal,

[R] R's list data structure

2012-02-17 Thread Ajay Askoolum
Given dayOfWeekName<-c("Mon","Tue","Wed","Thu","Fri","Sat","Sun"); dayOfWeekOrdinal<-c(1,2,3,4,5,6,0); dayOfWeekWorkDay<-c(TRUE,TRUE,TRUE,TRUE,TRUE,FALSE,FALSE); weekProfile<-list(dow=dayOfWeekName,dowI=dayOfWeekOrdinal,dowW=dayOfWeekWorkDay) 1. How can I conditionally get dow, dowI, and dowW f