[R] Dynamic resizing of lists, dataframes (newbie question)

Neil Osborne r_stuff_online at hotmail.com
Sun May 19 21:34:41 CEST 2002


Hi All,

I would be very grateful for some help with finding my way around R.
(I'm sure some of this is in the manual - but I just need to try some ideas 
out and I don't want to spend hours going through reams of text - BTW, I 
have checked the manual, and the stuff I want to do here is not covered 
explicitly ...)

This is a snippet of pseudo code  showing what I want to do in R

1).
#declare a dataframe (actually a time series)
mydata <- #declare a dataframe to hold date, value pairs (i.e. two columns)

2)
#dynamically size the dataframe and add a value
mydata[length(mydata) +1 ] <- #new date value pair

3)
#find the first occurence (date) on which a value occured
foo <- function(mydata, value) {
for (i in mydata)
{
   if (mydata[i] == value )
	#return x$date[i] ?
}

_________________________________________________________________



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list