G'day R (power) users,

I have a many vectors, called:

ib1
ib2
ib3
...
ib100

and I would like them in one data frame (df) such that:

> df

ib1  ib2   ib3  ib4 .....  ib100
x      x      x    x            x
x      x      x    x            x
x      x      x    x            x

I have attempted:

hold.list <- list(objects(pattern="ib"))
df <- data.frame(hold.list)

but that didn't work

also:
do.call(rbind, (objects(pattern="ib")))

and that also didn't work. I tried a whole pile of other things, where I
also failed.


The number of vectors might differ each time I want to make the data frame,
so that in the example above, I have ib1 : ib100, but next time, I might
only have ib1 : ib2

Below is my (probably somewhat embarrassing) example script for generating
the vectors in the first place. Commented out toward the end are a few
attempts at doing the job I wanted to do.


temp <- runif(100)
tripID <- rep(1:10, 10)
uni <- rep(1:4, 25)
temp <- data.frame(temp, tripID, uni)

trips <- unique(temp$tripID)
uni <- unique(temp$uni[temp$tripID==trips[1]])

for (jj in 1:length(uni)){
  a <- c()
  for (ii in 1:10){
    a <- c(a, IQR(temp$temp[temp$uni %in% sample(uni,jj)]))
    assign(paste("ib",jj,sep=""), a) # ib is short for ibuttons. The number
is how many were used to calc IQR
  }
#   hold.list <- list(objects(patter="ib"))
#   trip <- data.frame(list=hold.list # I am trying to put everything into
a dataframe
#   do.call("rbind", list=hold.list)
#   do.call("rbind", list(objects(pattern="ib")))
}


thanks heaps if you can help. And sorry if this is mostly garble. This is
my first crack at soliciting help from the list.

cheers,

mat


-- 
Mathew Vickers
PhD Student
James Cook University
CSRIO
Australia, mate.

        [[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