similar to: is it possible to form matrix of matrices...and multiple arrays

Displaying 20 results from an estimated 4000 matches similar to: "is it possible to form matrix of matrices...and multiple arrays"

2005 Nov 02
2
help : matrix row/column random mixing
Could anybody help me in mixing the matrix values randomly (first rows and then columns)... for eg putting the 1 st row in the place of 3 rd and 3rd in place of 4 th and 4th in place of 1st row ...something like this in columns also.. Please suggest me some ways.. thanks a lot.. with regards, boopathy. --------------------------------- [[alternative HTML version deleted]]
2005 Mar 28
2
Generating list of vector coordinates
Hi. Can anyone suggest a simple way to obtain in R a list of vector coordinates of the following form? The code below is Mathematica. In[5]:= Flatten[Table[{i,j,k},{i,3},{j,4},{k,5}], 2] Out[5]= {{1,1,1},{1,1,2},{1,1,3},{1,1,4},{1,1,5},{1,2,1},{1,2,2},{1,2,3},{1 ,2,4},{1,2, 5},{1,3,1},{1,3,2},{1,3,3},{1,3,4},{1,3,5},{1,4,1},{1,4,2},{1,4,3}, {1,4,
2010 Jul 06
4
Assign Formulas to Arrays or Matrices?
Hi, I am very new to R. I am hoping to create formulas and assign them to locations within an array (or matrix, if it will work). Here's a simplified example of what I'm trying to do: form.arr <- array(31,5,3) for (i in seq(from=1, to=31, by=1)) { for (j in seq(from=1, to=5, by=1)) { form.arr[i,j,] <- as.formula(y~1+2) } } which results in this error: Error in form.arr[i, j,
2003 Jul 30
6
reverse array indexing
Hi, Suppose I have a multidimensional array: tmp <- array(1:8, c(2,2,2)) is there a function out there that, given a one-dimensional array index, will return the separate indices for each array dimension? for instance, tmp[8] is equivalent to tmp[2,2,2]. I'd like to derive the vector (2,2,2) from the index 8. thanks, Brad Buchsbaum
2011 Nov 01
4
building a subscript programatically
Hi, On ocasion, you need to subscript an array that has an arbitrary (ie. not known in advance) number of dimensions. How do you deal with these situations? It appears that it is not possible use a list as an index, for instance this fails: > x <- array(NA, c(2,2,2)) > x[list(TRUE,TRUE,2)] Error in x[list(TRUE, TRUE, 2)] : invalid subscript type 'list' The only way I know is
2005 Feb 21
5
Compare rows of two matrices
Hello, #I have two matrices, eg.: y <- matrix( c(20, NA, NA, 45, 50, 19, 32, 101, 10, 22, NA, NA, 80, 49, 61, 190), ncol=4 ) x <- matrix( c(20, NA, NA, NA, 50, 19, 32, 101, 10, 22, NA, NA, 80, 49, 61, 190), ncol=4 ) #Whereas x contains all NA?s from y plus some additional NA?s. #I want to find the index of these additional NA?s. I think, there must be a very
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
2008 Nov 15
2
creating matrices from vectors
If I have 4 vectors (a, b, c, and d) each of length 1000, how do I then create 1000 two by two matrices from these vectors, such that: myMatrix[i] = matrix(c(a[i],b[i],c[i],d[i]),2) Then I'd like to create a single vector containing the largest eigenvalues of each matrix? (Sorry I am quite new to R) Many thanks, James _________________________________________________________________
2012 Jul 20
3
Execute a function
Hi, I would like to evaluate a function, with 3 arguments, for instance, myfunc<-function(a,b,c) { sqrt(a)-exp(b)+4*c } How to execute myfunc(x,y,z), for all x, all y and all z, where x,y,z are vectors? Thank you very much in advance -- View this message in context: http://r.789695.n4.nabble.com/Execute-a-function-tp4637182.html Sent from
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 =
2009 Sep 04
2
transforming a badly organized data base into a list of data frames
Dear R-ers! I have a badly organized data base in Excel. Once I read it into R it looks like this (all variables become factors because of many spaces and other characters in Excel):
2010 Jan 12
1
coerce vector into array - change filling sequence
Dear all, When I coerce a vector into a multi dimensional array, I would like R to start filling the array along the last dimension, then the 2nd last etc. Let's jump straight into an example. x <- 1 : 24 y <- array(dim=c(2,2,6)) I would like to have: y[1,1,1] = 1 y[1,1,2] = 2 ... y[1,1,6] = 6 y[1,2,1] = 7 y[1,2,2] = 8 ... y[2,1,1] = 13 ... y[2,2,1] = 19 if I do y<- array(x,
2012 Feb 03
1
aggregate arrays
Dear list after quite a bit of research in the archive, I gave up. This seems to be a simple problem: I would like to aggregate a (3-dimensional) array, either by another array, or by a vector, indicating the dimension which should be aggregated. I don't think I have to provide an example, it's really the 3-dimensional equivalent for the standard aggregate command. I am sure
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 Jul 05
1
getting values from arrays using which()
Dear R-Help, I have an array 1260x1260, upper triangle consisting of numbers between 0 and 100, and lower triangle all NA. I can extract the index of those values say above 99 using the following code: which(myArray>=99 , ind.arr=T) which returns: row col 5475 252 253 45423 764 765 46902 777 778 34146 611 962 50681 1220 1221 Now I would like to if poss print the actual value
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
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 =
2016 Dec 06
2
2.2.27 panic file mail-index-map.c: line 549 (mail_index_map_lookup_seq_range): assertion failed: (first_uid > 0)
On 06.12.2016 09:32, Toni Mattila wrote: > Hi, > > On 05-Dec-16 20:28, Toni Mattila wrote: >> Panicing stopped when all index files where deleted. > > It happens again in same user account, so rebuilding indexes didn't > fix it. > > Here's bt full instead of just bt: > #0 0x001d4402 in __kernel_vsyscall () > No symbol table info available. > #1
2018 Jun 08
4
Subsetting the "ROW"s of an object
> On Jun 8, 2018, at 11:52 AM, Hadley Wickham <h.wickham at gmail.com> wrote: > > On Fri, Jun 8, 2018 at 11:38 AM, Berry, Charles <ccberry at ucsd.edu> wrote: >> >> >>> On Jun 8, 2018, at 10:37 AM, Herv? Pag?s <hpages at fredhutch.org> wrote: >>> >>> Also the TRUEs cause problems if some dimensions are 0: >>>
2009 Jun 03
1
Need help understanding output from aov and from anova
Hi all, I noticed something strange when I ran aov and anova. vtot=c(7.29917, 7.29917, 7.29917) #identical values fac=as.factor(c(1,1,2)) #group 1 has first two elements, group 2 has the 3rd element When I run: > anova(lm(vtot~fac)) Analysis of Variance Table Response: vtot Df Sum Sq Mean Sq F value Pr(>F) fac 1 1.6818e-30 1.6818e-30 0.3333 0.6667 Residuals 1