Re: [R] Ignoring missing elements in data.frame()

2010-06-07 Thread Scott Chamberlain
Hi Joris, Thanks very much. I think the %in% ls() was the key. I just needed to know how to select elements that existed in ls(). Scott On Sat, Jun 5, 2010 at 4:22 PM, Joris Meys wrote: > Hi, > > One possible way to get around it is using following idea : > X1 <- rnorm(10) > X2 <- rnorm(10) >

Re: [R] Ignoring missing elements in data.frame()

2010-06-05 Thread Joris Meys
Hi, One possible way to get around it is using following idea : X1 <- rnorm(10) X2 <- rnorm(10) Names <- c("X1","X2","X3") Names <- Names[Names %in% ls()] n <- length(Names) p <- 10 #length of each object output <- matrix(NA,ncol=n,nrow=p) for(i in 1:n){ output[,i] <- get(Names[i]) } outp

[R] Ignoring missing elements in data.frame()

2010-06-04 Thread Scott Chamberlain
Hello, I am trying to make a data frame from many elements after running a function which creates many elements, some of which may not end up being real elements due to errors or missing data. For example, I have the following three elements p1s, p2s, and p3s. p9s did not generate the same data as