Re: [R] adding list to data.frame iteratively

2010-09-08 Thread fishkbob
> ll<-list(c("1","2","3"),c("2","3","4")) > ll [[1]] [1] "1" "2" "3" [[2]] [1] "2" "3" "4" > dd<-data.frame(matrix(nrow=10,ncol=3)) > dd X1 X2 X3 1 NA NA NA 2 NA NA NA 3 NA NA NA 4 NA NA NA 5 NA NA NA 6 NA NA NA 7 NA NA NA 8 NA NA NA 9 NA NA NA 10 NA NA NA > dd[1,]<-ll[[1]] > dd

Re: [R] How to make flowchart in R?

2010-08-16 Thread fishkbob
http://cran.r-project.org/web/packages/diagram/vignettes/diagram.pdf It might be difficult to include very large amounts of data, but names and counts should be fine. -- View this message in context: http://r.789695.n4.nabble.com/How-to-make-flowchart-in-R-tp2327246p2327273.html Sent from the R

Re: [R] merge function in R?

2010-08-16 Thread fishkbob
Thanks Chuck, I was trying to implement something more complicated than what I had to and after finding the reduce() function in bioconductor, everything went smoothly. Thanks again -- View this message in context: http://r.789695.n4.nabble.com/merge-function-in-R-tp2324684p2327133.html Sent

Re: [R] how to eliminate an element of a list

2010-08-13 Thread fishkbob
Try to do this > list <- seq(1,5,1) > list<-list[-3] > list [1] 1 2 4 5 list[-x] will remove the xth value in your list. Also you can do something like > list[-c(1:4)] [1] 5 To remove values at indexes 1-4 > list[-c(1,4)] [1] 2 3 5 To remove values at indexes 1 and 4 -- View this message in

[R] merge function in R?

2010-08-13 Thread fishkbob
So I have a bunch of c(start,end) points and want to consolidate them into as few c(start,end) as possible. For example: sample startend A 5 10 B 7 18 C 14 D 16 20 I'd want the function to return the two distinct

Re: [R] how to eliminate an element of a list

2010-08-13 Thread fishkbob
> list<-seq(2,10,2) > list [1] 2 4 6 8 10 > list[-which(2==list)] [1] 4 6 8 10 using the which() will let you remove things from a list that have a specified value... I usually use the blah<- blah[-which(TRUE==is.na(blah)) ] which will remove all NA values in your list -- View this mes

Re: [R] merge function in R?

2010-08-13 Thread fishkbob
I too think I worded it incorrectly... so the second two columns of the matrix are the start and end of an interval however, because some of the intervals overlap, I want to limit the number of intervals I have to deal with. So therefore, (5 10)should merge with(7 18) making

Re: [R] find value between two other numbers?

2010-08-13 Thread fishkbob
Awesome, that works great, and it cuts my runtime down by a lot. thanks baptiste I totally forgot that I could just check to see if the number was inbetween via less than and greater than rather than having to construct the vector. findInterval also helps with another problem I was having somew

[R] find value between two other numbers?

2010-08-12 Thread fishkbob
So basically I want to do this - 4 %in% 1:10 should return true Would there be another way of doing this without having to do the 1:10 part? I am using a very large data set and trying to do 459124 %in% 103000:983000 multiple times for many values, and it is taking quite a long time Also, I