Re: [R] Matrix Multiplication using R.

2013-08-15 Thread Hans Thompson
I'm not an expert useR but I asked a similar question to stack overflow that might give you new ideas. http://stackoverflow.com/questions/17458556/how-can-i-speed-up-this-sapply-for-cross-checking-samples On Thu, Aug 15, 2013 at 2:30 AM, Praveen Surendran wrote: > Dear Doran, Bert and Roger, >

[R] Raster images and saving with original pixel dimensions in tiff, jpeg, or png perferablly.

2013-03-02 Thread Hans Thompson
with making this work. The end result I'm hoping for would be an image exactly like the one I've read in (Rlogo.jpg for this small example). I turned off dev.copy lines because I'm not sure on the guidelines for file writing functions. Thanks, Hans Thompson Forgive me If I made an

[R] Two statement logical dealing with NAs

2012-12-10 Thread Hans Thompson
Hello. I have a two statement logical that if NA is returned for the second statement I want to rely on result of the first statement. I still would like to use both when I can though. x <- c(1:5) y <- c(1,2,NA,4,5) x < 5 & x-y == 0 How can I trick R to refer back to (x < 5) where it is NA on t

[R] Cropping a matrix by rows

2012-11-11 Thread Hans Thompson
Hello r-help, I've been banging my head against the computer in an attempt to learn how to divide my matrix into segments by rows. I want to be able to return each segment as a newly named object. I've tried looking at the apply functions and creating a for loop but brain no work. Here's the bas

[R] Chopping a two column data frame by rows into a three dimensional array.

2012-10-15 Thread Hans Thompson
If I have a two column data frame like: > dat <- cbind("x"=c(1:100),"y"=c(100:1)) How can I create an array that splits every ten rows of that data frame into a third dimension of an array so that: > newarray[,,1] ,,1 x y 1 100 2 99 3 98 ... ... 10 91 ,,2 xy 11 90 12 89 ...

[R] Creating ordered colors for ordered factors

2012-08-20 Thread Hans Thompson
I have been trying to find a way to label my cluster with the colors I want using factors. I am not having a good time. I can make the plot I'm looking for but how can I make it so I specify that my ordered factors have ordered colors (1= "blue", 2="green", 3="red")? x <- c(rnorm(10,1,1),rnorm(1

[R] Can someone recommend a package for SNP cluster analysis of Fluidigm microarrays?

2012-06-14 Thread Hans Thompson
I know that there are quite a few packages out that there for cluster analysis. The problem that I am facing is finding a package that will not incorporate all my samples into clusters but just the samples that fit a threshold (that I have not set yet and may need help finding the right level) for

Re: [R] applying cbind (or any function) across all components in a list

2012-05-25 Thread Hans Thompson
res[, k <- k + 1] <- midpoint(cx, cx - dist) >res[, k + 1] <- midpoint(colx, colx - 1) >res > } > > lapply(seq_len(length(l1)), function(i) fun1(l1[[i]], l2[[i]])) > lapply(seq_len(length(l1)), function(i) fun2(l1[[i]], l2[[i]])) > > > If I'm

Re: [R] applying cbind (or any function) across all components in a list

2012-05-24 Thread Hans Thompson
The function I am giving for context is cbind. Are you asking how I would like to apply the answer to my question? I am trying to take the results of a Fluidigm SNP microarray, organized by assay into a list (each component is the results of one assay), find coordinate midpoints ([1,] and [2,] of

Re: [R] applying cbind (or any function) across all components in a list

2012-05-24 Thread Hans Thompson
Yes. This gives me: [,1] [,2] [,3] [,4] [1,]1234 [2,]2345 [,1] [,2] [,3] [,4] [1,]6789 [2,]789 10 BUT, how can I have it still within components like [[1]] [,1] [,2] [,3] [,4] [1,]1234 [2,]23

Re: [R] applying cbind (or any function) across all components in a list

2012-05-24 Thread Hans Thompson
I'm confused why I haven't made clear what I am asking for help with. I have two different lists with two (or many) components, [[1]] and [[2]]. One of the list has components with dim=c(2,3) and the other has dim=c(2,2). I want to create a new list with components dim=c(2,4) by binding togeth

Re: [R] applying cbind (or any function) across all components in a list

2012-05-24 Thread Hans Thompson
The combination of column means in cbind is what I am trying to do. I just don't know how to do it for every component (2 in this case) of the list. I've been able to work with R to apply a function across all components when there is just one list but I am having trouble working with multiple li

[R] applying cbind (or any function) across all components in a list

2012-05-23 Thread Hans Thompson
#If I have two lists as follows a1<- array(1:6, dim=c(2,3)) a2<- array(7:12, dim=c(2,3)) l1<- list(a1,a2) a3<- array(1:4, dim=c(2,2)) a4<- array(5:8, dim=c(2,2)) l2<- list(a3,a4) #how can I create a new list with the mean across all arrays within the list, so all components are included

Re: [R] Returning the coef from two coordinates

2012-04-27 Thread Hans Thompson
Where can I find the posting guide? I've been trying to use "A handbook of Statistical Analyses Using R" and google searching but I will be reading "An Introduction to R" now that I see its better to starting out then using the "?function". sorry. -- View this message in context: http://r.78969

Re: [R] Returning the coef from two coordinates

2012-04-27 Thread Hans Thompson
I meant (1,1) as an (x,y) coordinate. I am trying to find the function to return the coefficient of the line running through: >B x y a 1 1 and all the points in: >A x y a 1 3 b 2 2 c 3 1 hope that is more clear. Thanks again Rui. -- View this message in context: htt

[R] Returning the coef from two coordinates

2012-04-27 Thread Hans Thompson
Thank you to everyone in this forum that has been helping me with the basic R skills while I learn to apply them. I would like to take the coefficient of two coordinates. One of them comes from two different columns in a table: >A x y a 1 3 b 2 2 c 3 1 the other is set and

Re: [R] Basic matrix manipulation problem

2012-04-25 Thread Hans Thompson
Thanks Rui and Jeff, I thought that transposing the matrix would let me plot it the way I thought it would but it did not. How can I take: matrix "e": AAB BAB CCD DCD x 1.75 2.25 3.25 3.75 y 6.25 6.75 7.25 7.75 and treat the x and y rows as the x and y axis values and plot th

Re: [R] Basic matrix manipulation problem

2012-04-25 Thread Hans Thompson
Is there a function I can use to invert the final table rows and columns? I'd like to plot the x and y so that I can place them with another point and get coefficient values. So: AAB BAB CCD DCD x 1.75 2.25 3.25 3.75 >y 6.25 6.75 7.25 7.75 to "A" x y AAB BA

Re: [R] Basic matrix manipulation problem

2012-04-25 Thread Hans Thompson
Yes. This worked very well for what I am trying to do. The only problem I had though was figuring out why dimnames(a) <- list(c("x","y"), LETTERS[1:4]) would not list the rows as x and y. I changed it though to letters[24:25] Thanks again Petr. -- View this message in context: http://r.7

[R] Basic matrix manipulation problem

2012-04-24 Thread Hans Thompson
Hello, this forum was very helpful yesterday with a simple question I had on working with tables. What function will I need to use to do the following. Move matrix a: AB C D x1234 y5678 to the mean of B&C and C&D: BC CD x 2.5 3.5 y