similar to: dimension values of an array

Displaying 20 results from an estimated 20000 matches similar to: "dimension values of an array"

2008 Aug 25
1
"rval, symbol print name too long"?
Is there anyone who can tell me what this means (I call a table, that is stores as csv file): Error in do.call("data.frame", rval) : symbol print-name too long Thanks you in advance,Akko Eleveld _________________________________________________________________ [[alternative HTML version deleted]]
2008 Aug 21
1
HELP: how to add weight to a [x,y] coordinate
Anyone who can help me with the following question? How can I add weight to [x,y] coordinates on a graph/scatterplot? Background: Monte Carlo simulation generated 730,000 [x,y] coordinates with a weight attached (from 0-0.5). Both x and y are rounded and fit on a raster with x-axis 0-170 months (smalles unit = 1 month) and y-axis 0-6 (smallest unit=0.1). I would like every [x,y] to add its
2008 Aug 18
1
Please help: Limit single row calculation
Is there anyone who can help me with the following? It's hard to describe in a few words, but hope you'll understand. I attempt to model refugee mortality over time using Monte Carlo. Before doing repetitive simulations, my function should go through only one survey/row at the time, but instead gives outcomes of all studies/rows, which is not correct, because it uses random numbers
2011 May 19
2
Add a vector to the values in a specific dimension of an array
Hello, A simple question, although I can't find an answer via my google/forum search: I have a 4-dimensional array; call it A[1:M,1:N,1:P,1:Q]. I have a vector x that is N by 1. I would like to "quickly" add x to the 2nd dimension of A; in other words, I want a quicker way of doing the following: for (m in 1:M) { for (p in 1:P) { for (q in 1:Q) { A[m,,p,q] =
2009 May 14
3
memory usage grows too fast
Hi All, I have a 1000x1000000 matrix. The calculation I would like to do is actually very simple: for each row, calculate the frequency of a given pattern. For example, a toy dataset is as follows. Col1 Col2 Col3 Col4 01 02 02 00 => Freq of ?02? is 0.5 02 02 02 01 => Freq of ?02? is 0.75 00 02 01 01 ? My code is quite simple as the following to find the pattern ?02?.
2012 Jan 24
1
List to Array: How to establish the dimension of the array
Given a variable aa in the workspace, some of its attributes are: > typeof(aa) [1] "list" > mode(aa) [1] "list" > length(aa) [1] 2 How do I retrieve the maximum indices, in this case 2,3,4? The variable itself is: > aa [[1]] [[1]][[1]] [[1]][[1]][[1]] [1] 37531.52 [[1]][[1]][[2]] [1] 62787.32 [[1]][[1]][[3]] [1] 5503.184 [[1]][[1]][[4]] [1] 33832.8
2008 Sep 10
1
Return dimension index from array with n-dimensions
Hi, I have been dealing with some problems finding a fast way of getting to know in what dimension a specific value is located out of an array (like the 'which' function for a vector returns its position). Unable to find anything about this on the internet I wrote a function myself. Could you please comment if such a function already exists, and if not, please feel free to comment the
2011 Jan 17
1
how to cut a multidimensional array along a chosen dimension and store each piece into a list
Dear R-Helpers, I wonder whether there is a function which cuts a multiple dimensional array along a chosen dimension and then store each piece (still an array of one dimension less) into a list. For example, arr <- array(seq(1*2*3*4),dim=c(1,2,3,4)) # I made a point to set the length of the first dimension be 1to test whether I worry about drop=F option. brkArrIntoListAlong <-
2009 Jul 25
1
Determine the dimension-names of an element in an array in R
Hi: How can I extract the dimension-names of a pre-defined element in a multidimensional array in R ? A toy example is provided below: I have a 4-dimensional array with each dimension having certain length. In the below example, "mydatastructure" explains the structure of my data. mydatastructure = array(0, dim=c(length(b),length(z),length(x),length(d)), dimnames=list(b,z,x,d)) where,
2012 Jan 08
1
Difference across the Nth dimension of an array
I have a multidimensional array - in this case with 4 dimensions of x,y,z and time. I'd like to take the time derivative of this matrix, i.e. perform the diff operator along dimension number 4. In Matlab, there is a simple option to specify which dimension the difference is to be taken across., but I can't see this in R. I realise I can use aperm to rotate my array so that time is in
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
2009 May 28
1
maximum over one dimension of a 3-dimensional array
Hi, I'm running R 2.7.2 on windows XP. I'd like to find the maximum of a 3-d array over it's third index to create a 2-d array. For example: > x <- array(c(1,2,3,10,11,12,3:8),c(2,3,2)) > x , , 1 [,1] [,2] [,3] [1,] 1 3 11 [2,] 2 10 12 , , 2 [,1] [,2] [,3] [1,] 3 5 7 [2,] 4 6 8 > x1 <- x[,,1] > x2 <- x[,,2] >
2008 May 13
2
array dimension changes with assignment
Why does the assignment of a 3178x93 object to another 3178x93 object remove the dimension attribute? > GT <- array(dim = c(6,nrow(InData),ncol(InSNPs))) > dim(GT) [1] 6 3178 93 > SNP1 <- InSNPs[InData[,"C1"],] > dim(SNP1) [1] 3178 93 > SNP2 <- InSNPs[InData[,"C2"],] > dim(SNP2) [1] 3178 93 > dim(pmin(SNP1,SNP2)) [1] 3178 93
2006 Jun 20
2
multi-dimension array of raw
I would like to store and manipulate large sets of marker genotypes compactly using "raw" data arrays. This works fine for vectors or matrices, but I run into the error shown in the example below as soon as I try to use 3 dimensional arrays (eg. animal x marker x allele). > a <- array(as.raw(1:6),c(2,3)) > a [,1] [,2] [,3] [1,] 01 03 05 [2,] 02 04 06 >
2017 Jun 07
0
Adding zeros in each dimension of an array
Please read https://www.lifewire.com/how-to-send-a-message-in-plain-text-from-gmail-1171963 Re your question: easy is in the eye of the beholder. a <- array( 1:12, dim = c( 2, 2, 3 ) ) b <- array( 0, dim = dim( a ) + 1 ) b[ 1:2, 1:2, 1:3 ] <- a If you want to do a lot of this, it could be wrapped for convenience though implementing that last expression without hardcoding the sequences
2017 Jun 07
3
Adding zeros in each dimension of an array
For a data frame, we can add an additional row or column easily. For example, we can add an additional row of zero and an additional row of column as follows. Is there an easy and similar way to add zeros in each dimension? For example, for array(1:12, dim=c(2,2,3))? Thanks for your help!! Hanna > x <- as.data.frame(matrix(1:20,4,5))> x[5,] <- 0> x[,6] <- 0> x V1 V2
2003 Oct 31
4
Array Dimension Names
I would like to reference array dimensions by name in an apply and a summary function. For example: apply(x, "workers", sum) Is there a better way to do this than creating a new attribute for the array and then creating new methods for apply and summary? I don't want to name the individual elements of each dimension (such as with dimnames) but rather name the dimensions. Thanks
2011 Feb 18
6
sort a 3 dimensional array across third dimension ?
I'm attempting to sort a 3 dimensional array that looks like this > x , , 1 [,1] [,2] [1,] 9 9 [2,] 7 9 , , 2 [,1] [,2] [1,] 6 5 [2,] 4 6 , , 3 [,1] [,2] [1,] 2 1 [2,] 3 2 Such that it ends up like this .... > y , , 1 [,1] [,2] [1,] 2 1 [2,] 3 2 , , 2 [,1] [,2] [1,] 6 5 [2,] 4 6 , , 3 [,1] [,2]
2017 Jun 01
0
Reversing one dimension of an array, in a generalized case
How about this: f <- function(a,wh){ ## a is the array; wh is the index to be reversed l<- lapply(dim(a),seq_len) l[[wh]]<- rev(l[[wh]]) do.call(`[`,c(list(a),l)) } ## test z <- array(1:120,dim=2:5) ## I omit the printouts f(z,2) f(z,3) Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into
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