similar to: multidimensional lists

Displaying 20 results from an estimated 20000 matches similar to: "multidimensional lists"

2024 Feb 27
4
converting MATLAB -> R | element-wise operation
So, trying to convert a very long, somewhat technical bit of lin alg MATLAB code to R. Most of it working, but raninto a stumbling block that is probaably simple enough for someone to explain. Basically, trying to 'line up' MATLAB results from an element-wise division of a matrix by a vector with R output. Here is a simplified version of the MATLAB code I'm translating: NN = [1,
2024 Feb 27
2
[External] converting MATLAB -> R | element-wise operation
> t(t(NN)/lambda) [,1] [,2] [,3] [1,] 0.5 0.6666667 0.75 [2,] 2.0 1.6666667 1.50 > R matrices are column-based. MATLAB matrices are row-based. > On Feb 27, 2024, at 14:54, Evan Cooch <evan.cooch at gmail.com> wrote: > > So, trying to convert a very long, somewhat technical bit of lin alg > MATLAB code to R. Most of it working, but raninto a stumbling block
2024 Feb 27
2
converting MATLAB -> R | element-wise operation
Why anything but sweep? The fundamental data type in Matlab is a matrix... they don't have vectors, they have Nx1 matrices and 1xM matrices. Vectors don't have any concept of "row" vs. "column". Straight division is always elementwise with recycling as needed, and matrices are really vectors in row-major order: 1 2 3 4 5 6 is really 1 4 2 5 3 6 and when you do
2006 Sep 06
3
continuation lines in R script files
When I have to enter a very large matrix into the R console, I can make use of the continuation feature in the console to enter the matrix in pieces (e.g., on a row by row basis). So, for example, the console would show the "+" sign for continuation lines - something like what I've written below: a=matrix(c(0,20,50, + 0.05,0,0, + 0,0.1,0), + 3,3,byrow=T) (obviously, for a
2009 Mar 25
2
need help with ordering of plots
I want to do a series of contour plots, 4 in all. The data is coming from a data frame named "nd.frame", which has elements "xdf", "ydf", "zdf", and "pndt". I am treating "pndt" as a factor, and it has four levels. I make a call to the lattice graphics routine "contourplot" like so:
2010 Mar 31
2
Generative Topographic Map
I tried to use R version of package I noticed the original MatLab Pckage is much better documented. I had a look at the R demo code "gtm_demo" and found that variable Y is used in advanced of being created: I wrote my own few lines as follows: inDir <- "C:/Documents and Settings/Monville/Alanine Dipeptide/DBP1/DHA" setwd(inDir) T <-
2011 Aug 01
3
General indexing in multidimensional arrays
Dear R community, I have a general question regarding indexing in multidiemensional arrays. Imagine I have a three dimensional array and I only want to extract on vector along a single dimension from it: data <- array(rnorm(64),dim=c(4,4,4)) result <- data[1,1,] If I want to extract more than one of these vectors, it would now really help me to supply a logical matrix of the
2011 Nov 04
6
Matrix element-by-element multiplication
is there a way to do element-by-element multiplication as in Gauss and MATLAB, as shown below? Thanks. --- a 1.0000000 2.0000000 3.0000000 x 1.0000000 2.0000000 3.0000000 2.0000000 4.0000000 6.0000000 3.0000000 6.0000000 9.0000000 a.*x 1.0000000 2.0000000 3.0000000 4.0000000
2017 Sep 28
3
building random matrices from vectors of random parameters
Suppose I have interest in a matrix with the following symbolic structure (specified by 3 parameters: sa, so, m): matrix(c(0,sa*m,so,sa),2,2,byrow=T) What I can't figure out is how to construct a series of matrices, where the elements/parameters are rnorm values. I'd like to construct separate matrices, with each matrix in the series using the 'next random parameter value'.
2012 Apr 12
3
writing spdiags function for R
Dear R-list, I am in the process of translating a long function written in Matlab into R (mainly because I am a big of fan of R, and folks will not have to pay to use it :). In the translation of this function I got stack because they use spdiags, which, as far as I can tell it is not available in R. I have explored the Matrix package, from which I borrowed some of the functions (e.g.,
2006 Nov 09
2
Repeated Measures MANOVA in R
Can R do a repeated measures MANOVA and tell what dimensionality the statistical variance occupies? I have been using MATLAB and SPSS to do my statistics. MATLAB can do ANOVAs and MANOVAs. When it performs a MANOVA, it returns a parameter d that estimates the dimensionality in which the means lie. It also returns a vector of p-values, where each p_n tests the null hypothesis that the mean
2003 Apr 03
2
Matrix eigenvectors in R and MatLab
Dear R-listers Is there anyone who knows why I get different eigenvectors when I run MatLab and R? I run both programs in Windows Me. Can I make R to produce the same vectors as MatLab? #R Matrix PA9900<-c(11/24 ,10/53 ,0/1 ,0/1 ,29/43 ,1/24 ,27/53 ,0/1 ,0/1 ,13/43 ,14/24 ,178/53 ,146/244 ,17/23 ,15/43 ,2/24 ,4/53 ,0/1 ,2/23 ,2/43 ,4/24 ,58/53 ,26/244 ,0/1 ,5/43) #R-syntax
2017 Sep 28
2
building random matrices from vectors of random parameters
Sure -- thanks -- only took me 3-4 attempts to get aperm to work (as opposed to really thinking hard about how it works ;-) On 9/28/2017 11:55 AM, Duncan Murdoch wrote: > On 28/09/2017 9:10 AM, Evan Cooch wrote: >> Thanks for both the mapply and array approaches! However, although >> intended to generate the same result, they don't: >> >> # mapply approach
2010 Jun 10
1
importing multidimensional matrix from MATLAB
Hi, Suppose I have a matrix of size 256x14x32 in MATLAB. I want to import that into R. I used readMat and then do.call. But the variable is stored as an array as its done in R. However, I want to define a variable W=array(0,c(256,14,32)) in R and read the multidimensional matlab variable into W. I am not able to do this in R. Please, could you help ? Thanks Gopi [[alternative HTML version
2017 Sep 28
3
building random matrices from vectors of random parameters
Thanks for both the mapply and array approaches! However, although intended to generate the same result, they don't: # mapply approach n = 3 sa <- rnorm(n,0.8,0.1) so <- rnorm(n,0.5,0.1) m <- rnorm(n,1.2,0.1) mats = mapply(function(sa1, so1, m1) matrix(c(0,sa1*m1,so1,sa1),2,2,byrow=T), sa, so, m, SIMPLIFY = FALSE) print(mats) [[1]] ????????? [,1]????? [,2] [1,] 0.0000000
2008 Nov 19
2
Multidimensional array with R
Hi there I know, I'm sure you discussed this stuff 100 times, but I really have a basic understanding problem, if and how do I create a multidimensional array in R. I'm coming from MATLAB and there it's as easy as you ever could imagine. Ok, so, I want to have an array, where I can fill in data from a Excel spreadsheet. The array should be addressed like this:
2004 Oct 07
8
Equivalents of Matlab's 'find' and 'end'
Sorry if these questions have been asked recently--I'm new to this list. I'm primarily a Matlab user who is attempting to learn R and I'm searching for possible equivalents of commands that I found very handy in Matlab. So that I don't seem ungrateful to those who may answer, I HAVE determined ways to carry out these processes in 'brute force' sorts of ways in R code,
2012 May 14
3
How to apply a function to a multidimensional array based on its indices
Hello. I have a 4 dimensional array and I want to fill in the slots with values which are a function of the inputs. Through searching the forums here I found that the function "outer" is helpful for 2x2 matrices but cannot be applied to general multidimensional arrays. Is there anything which can achieve, more efficiently than the following code, the job I want? K <-
2005 Nov 24
2
Fwd: Matrix rotation
Ok I warned you that I'd been drinking! What I really meant was something to go from: [,1] [,2] [1,] 1 2 [2,] 4 3 to [,1] [,2] [1,] 4 1 [2,] 3 2 to [,1] [,2] [1,] 3 4 [2,] 2 1 to [,1] [,2] [1,] 2 3 [2,] 1 4 Sorry for being a muppet, B Begin forwarded message: > From: Benjamin Lloyd-Hughes
2017 Sep 28
0
building random matrices from vectors of random parameters
On 28/09/2017 9:10 AM, Evan Cooch wrote: > Thanks for both the mapply and array approaches! However, although > intended to generate the same result, they don't: > > # mapply approach > > n = 3 > sa <- rnorm(n,0.8,0.1) > so <- rnorm(n,0.5,0.1) > m <- rnorm(n,1.2,0.1) > mats = mapply(function(sa1, so1, m1) > matrix(c(0,sa1*m1,so1,sa1),2,2,byrow=T),