[R] problem with putting objects in list

Rainer M Krug rkrug at sun.ac.za
Fri Sep 8 10:01:43 CEST 2006


Thanks a lot - it looks like the sort of manual I was looking for -
Could I suggest of including it into the list of manuals for R? (If it
is already there, my apologies)

Rainer

Patrick Burns wrote:
> S Poetry should help you understand this.  See
> especially the section of chapter 1 on subscripting.
> 
> Patrick Burns
> patrick at burns-stat.com
> +44 (0)20 8525 0696
> http://www.burns-stat.com
> (home of S Poetry and "A Guide for the Unwilling S User")
> 
> Rainer M Krug wrote:
> 
>> Hi
>>
>> I use the following code and it stores the results of density() in the
>> list dr:
>>
>> dens <- function(run) { density( positions$X[positions$run==run], bw=3,
>> cut=-2 ) }
>> dr <- lapply(1:5, dens)
>>
>> but the results are stored in dr[[i]] and not dr[i], i.e. plot(dr[[1]])
>> works, but plot([1]) doesn't.
>>
>> Is there any way that I can store them in dr[i]?
>>
>> Thanks a lot,
>>
>> Rainer
>>
>>
>>
>>  
>>


-- 
Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation
Biology (UCT)

Department of Conservation Ecology and Entomology
University of Stellenbosch
Matieland 7602
South Africa

Tel:		+27 - (0)72 808 2975 (w)
Fax:		+27 - (0)21 808 3304
Cell:		+27 - (0)83 9479 042

email:	RKrug at sun.ac.za
      	Rainer at krugs.de



More information about the R-help mailing list