similar to: summing array elements

Displaying 20 results from an estimated 10000 matches similar to: "summing array elements"

2012 Oct 14
1
plotting principal components on geographic map
Dear all, I have a dataset representing several geographical points (locations), each one having a specific value after performing a PCA. Now I'm trying to understand how to separately represent on a geographic map (of Europe) the pattern of PC1,2, ecc.with colors (e.g.heatmap) I have to add that the dataset includes relatively few points. Therefore, I would also like to interpolate the values
2011 Mar 08
1
repeat matrix column within each array third dimension
Hello all, I'm working with a matrix that will have varying dimensions. It will populate an array such that the number of matrix columns will determine the number of 3rd dimension levels of the array. Rows will be the same for both. For this example lets say the array will have 2 columns, but that's not fixed. dim(arr)<-c(dim(mat)[1],2,dim(mat)[2]) I wish to repeat each matrix
2005 Mar 16
8
Summing up matrices in a list
Dear all, I think that my question is very simple but I failed to solve it. I have a list which elements are matrices like this: >mylist [[1]] [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 [[2]] [,1] [,2] [,3] [1,] 7 9 11 [2,] 8 10 12 I'd like to create a matrix M<-mylist[[1]]+mylist[[2]] [,1] [,2] [,3] [1,] 8 12 16 [2,] 10 14 18
2007 Aug 17
1
[BioC] function to find coodinates in an array
The arr.ind in the which function does the job very nicely!!! Thank you everyone for the suggestions! Ana > > >---- Mensaje Original ---- >De: marc_schwartz at comcast.net >Para: m_olshansky at yahoo.com >Asunto: Re: [BioC] [R] function to find coodinates in an array >Fecha: Thu, 16 Aug 2007 21:53:44 -0500 > >>If I am correctly understanding the problem, I think
2010 Dec 27
2
Finding indexes of minum and maximum elements of an array
Hello there I wish to get the "coordinates" of the minimum element of an array. For example, if the array were > H = array(c(8:5,1:4),dim=c(2,2,2)) > H , , 1 [,1] [,2] [1,] 8 6 [2,] 7 5 , , 2 [,1] [,2] [1,] 1 3 [2,] 2 4 then > min(H) [1] 1 and > max(H) [1] 8 Say "idx" were the function I'm looking for. Then, what
2011 May 16
1
Extracting the dimnames of an array with variable dimensions
Hi list, In a function I am writing, I need to extract the dimension names of an array. I know this can be acheived easily using dimnames() but my problem is that I want my function to be robust when the number of dimensions varies. Consider the following case: foo <- array(data = rnorm(32), dim = c(4,4,2), dimnames=list(letters[1:4], LETTERS[1:4], letters[5:6])) # What I want is to extract
2006 Aug 09
2
Speeding indexing and sub-sectioning of 3d array
Hi, I am having a problem with a very slow indexing and sub-sectioning of a 3d array: > dim(arr) [1] 245 175 150 For each point in the array, I am trying to calculate the mean of the values in its surrounding: mean( arr[ (i - radius):(i + radius), (j - radius):(j + radius), (k - radius):(k + radius)] ) Putting that code in 3
2011 Sep 20
1
Boxplots from 4 dimensional array
Hello list members, I am working with simulated data for landscape pattern analysis. I have 1000 replicates of binary (2 colour) gridded landscapes at each combination of 9 levels of class proportion and 11 levels of spatial autocorrelation. The results are stored in an array as follows: > dim(surfaces) [1] 38 9 11 1000 The dimensions are defined as follows: [x,,,] 1:38, integers
2006 Jun 02
2
basic array question
I have a large array and would like to extract from it the row and column indices just of values for which a particular boolean condition is true. I assume there's a simple way to do this, but I haven't figured it out yet. Any help would be appreciated. Tim
2011 Sep 27
1
array extraction
hello everyone. Look at the following R idiom: a <- array(1:30,c(3,5,2)) M <- (matrix(1:15,c(3,5)) %% 4) < 2 a[M,] <- 0 Now, I think that "a[M,]" has an unambiguous meaning (to a human). However, the last line doesn't work as desired, but I expected it to...and it recently took me an indecent amount of time to debug an analogous case. Just to be explicit, I would
2012 Mar 30
2
Finding the maximum elements in an array/matrix
Hello, I would like to find the maximum element in a matrix or an array but it does not return what I want. For example, If I have a 2*2 matrix A whose maximum element is the A(1,2). I would like the answer (1,2), but it returns 3, which is the ordinal if one counts by columns. Is there any function that returns (1,2)? Thanks > A<-rbind(c(1,4), c(3,2))> A [,1] [,2] [1,]
2005 Oct 17
2
how to find indices of particular array elements
Dear R helpers, I have a largish matrix (1300 x 1300) and I wish to find the row and column numbers that identify particular elements whose values I know in advance (for example, the row and column numbers for the maximum value of the matrix). I have looked in the help manual and found the functions 'row' and 'col' for finding the indices of a matrix. But, I can't figure out
2007 May 21
3
an array of matrices
I'd like to have a three dimensional array of matrices. I thought I could construct a five dimensional array to have the three dimensional array of matrices. However, not all of the matrices in the array have the same dimensions, which seems to mean I can't use a five dimensional array. What I'd like is this: A = matrix(1:4,2,2) B = matrix(1:25,5,5) C = matrix(1,3,3) D =
2010 Jan 08
3
strange behavior of R
Hi I observed an interesting behavior of R. Can you find where is the bug, or it is not a bug but made deliberately. - Hide quoted text - > arr = c(); #defined the empty array > a= c("x1", "x2"); > b = c("y1", "y2"); > arr = rbind(arr,a); #row bind the first character array -a > arr =
2006 Aug 11
2
Array#chunk method, maybe someone will find this useful
class Array # break an array up into <size> chunks def chunk(size=1) return self if self.empty? raise ArgumentError if !size.kind_of? Integer y = self.length.divmod(size) rows = (y[1] > 0) ? y[0] + 1 : y[0] arr = Array.new(rows) (0...rows).each do |i| arr[i] = self.slice(size*i, size) end (arr.last.length...size).each { |i| arr.last[i] = nil }
2009 May 15
0
[LLVMdev] Removing std::vector from APIs (was Re: Mutating the elements of a ConstantArray)
On Friday 15 May 2009 05:50, Jay Foad wrote: > > 3. Any comments on the patch itself? > > > > The one major thing to be aware of is that it isn't safe to use &V[0] > > when V is an empty std::vector > > Oh dear. That's a bit of a flaw in the plan. I suppose the solution is > to switch to SmallVector whenever this might be a problem. Or use iterators.
2003 May 26
4
spinning and flipping arrays
Hello people, Is there some simple way of spinning and/or flipping arrays in R? Here's what I mean. Suppose that foo is a 2x3x4 array with the following contents: (I know this is different than typing 'foo' at and R prompt, but I'm so used to row major order from using APL, I have a hard time with R's output) > foo[1,,] [,1] [,2] [,3] [,4] [1,] 1 2 3 4
2017 Jun 01
5
Reversing one dimension of an array, in a generalized case
Hi All: I have been looking for an elegant way to do the following, but haven't found it, I have never had a good understanding of any of the "apply" functions. A simplified idea is I have an array, say: junk(5, 10, 3) where (5, 10, 3) give the dimension sizes, and I want to reverse the second dimension, so I could do: junk1 <- junk[, rev(seq_len(10), ] but what I am
2010 Mar 23
3
Summing with NA
Hi all, May I request for your help if you have time and if you have an idea on how to do this. I want to add three vectors... And my goal is to obtain the sum of the vectors, ignoring the vector of "na"... Here is what i did in R.. I'm adding the three vectors, e,z,k, and my objective is to get an answer = -23. I tried putting the na.omit but it did not work. Thanks. > z [1]
2011 Aug 05
1
Dichotomous variables
Hi everyone, Have sample of items for each one, a set of 20 dichotomous (absent-present) variables are expressed. I'm trying to understand how to explore the co-occurence of each variable. Read some papers concerning smallest space analysis, but it does not seems implemented in any R package (and my protamming skills are =0). Non metric MDS gives error messages, probably because of the