Displaying 20 results from an estimated 5000 matches similar to: "How to apply vector value function to a multidimensional array indexed by the remaining dimensions?"
2009 Mar 06
2
How to apply a function to slices of multidimensional arrays, and not just iterating through single elements
Hello,
If I want to apply some f(x) to such chunks of the the array
dim(A)==c(d1,d2,d3,..,dk,...,dn) which are defined by A[...,ik,...]
(ik belongs to {1,..,dk}), for now I use iteration via 'for (i in
dim(A)[k]) f(A[...,k,...])' . Is there any more elegant approach, e.g
like in 'apply' function which you can use on margin of the array.
Just in my case I want the entire slice
2016 Apr 24
2
How to take a multidimensional data set to higher dimensions using R?
Hi,
I have a multidimensional data-set( multiple 'x' variables with a target
variable). I want to take it to a higher dimensional space so that I can
apply classification technique with ease . Is there a package in R which
would allow me to take these data points from lower dimensional space to
higher dimensions? so that is that higher dimension I can apply
classification techniques to be
2008 Nov 05
2
access (exactly/only) one dimension of a multidimensional table
Dear list,
I have a multi(3)dimensional table, which is printed as two tables:
> table.a
, , = female
not at all a little medium heavy
no 53 27 8 6
yes 30 67 61 66
, , = male
not at all a little medium heavy
no 31 20 11 5
yes 5 19 34 25
How can I access (manipulate)
2010 Oct 01
2
element wise conditional assignment in r
Hi,
I am looking for a one-liner code for the following situation
say I have a vector r of 0 and 1's, and another vector v of equal length. I
want to assign v[i]-1 to v[i] if r[i]=1, for all i. How would I do that
using mapply or any other batch processing keywords? thanks.
John
--
View this message in context:
2010 Dec 09
1
Number of dimension in Multidimensional Scaling
Hello!
Very often one can hear that MDS usually ends with two-dimensional
solution. Of course, there are methods, like Scree-test (proposed by
Kruskal and Wish, 1981), to determine optimal number of dimensions.
However, I am trying to find references to this two-dimensional
gold-standard. Can anyone point me to authors which explicitly states
that two-dimensions are typical and easiest to
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 <-
2012 May 15
0
How to apply a function to a multidimensional array, based on its indices
Hello,
Your way is much better than to mess with the dim attribute, like I did.
But,
"If you can create a data.frame or matrix that has the indices"
Actually, it must be a matrix, indices can't be of type list.
A way to avoid loops/apply altogether, and much faster, is the one
creating K3
(K is the result from the op.)
n <- 20
t2 <- system.time({
K2 <-
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 <-
2003 Dec 30
1
Accuracy: Correct sums in rowSums(), colSums() (PR#6196)
Full_Name: Nick Efthymiou
Version: R1.5.0 and above
OS: Red Hat Linux
Submission from: (NULL) (162.93.14.73)
With the introduction of the functions rowSums(), colSums(), rowMeans() and
colMeans() in R1.5.0, function "SEXP do_colsum(SEXP call, SEXP op, SEXP args,
SEXP rho)" was added to perform the fast summations. We have an excellent
opportunity to improve the accuracy by
2005 Nov 03
1
multidimensional integration not over a multidimensionalrectangle
Hi,
anyone knows about any functions in R can get multidimensional integration
not over a multidimensional rectangle (not adapt).
For example, I tried the following function f(x,n)=x^n/n!
phi.fun<-function(x,n)
{ if (n==1) {
x
}else{
integrate(phi.fun, lower=0, upper=x, n=n-1)$value
}
}
I could get f(4,2)=4^2/2!=8, but failed in f(4,3)=4^3/3! Thanks
Best,
Lynette
2011 Oct 05
2
cuhre usage ?? multidimensional integration
my=function(x){
len=1
for(i in 1:len){
y[i]=x[i]
}
g=1
w=NULL
t=NULL
for(i in 1:len)w[i]=x[i+len]
for(i in 1:len)t[i]=x[i+2*len]
for(i in 1:len)g=g*dnorm(y[i])*dnorm(w[i])*dnorm(z[i])
return(g)
}
cuhre(6,1,my,rep(-100,6),rep(100,6))
Error in crff(match.call(), integrand, "cuhre", libargs, ...) :
Additional argument not expected in the integrand function
function change to
2011 Oct 21
2
Converting data frame into multidimensional array
Consider the following data frame
X <- data.frame(Titanic)
Does anyone know of an easy way to convert X into a multidimensional
array? Example that doesn't work
X <- as.array(X, dim=c(4,2,2,2))
To do what I need, X needs to be converted into an array of dimensions
c(4,2,2,2) in this case, not a table.
Thanks in advance.
2011 Jan 20
2
Using a list as multidimensional indexer
Hello list.
Another 'puzzle' for which I don't have a clean solution.
Say I have a multidimensional object, e.g.:
Mm<-matrix(1:6, nrow=2, dimnames=list(c("a","b"), c("g","h","i")))
And on the other hand I have a list
Ind<-list("b","g")
This holds, for each dimension, an indexer for that dimension.
Now I would
2005 Jun 28
1
enhanced multidimensional scaling?
Dear R list
Would anyone be able to tell me whether it is possible to do "enhanced
multidimensional scaling" (enhanced MDS) in R? In other words, something that
goes beyond "cmdscale" by iteratively improving the fit between observed
dissimilarities and inter-object distances, using the KYST algorithm
(Kruskal, 1964).
I have found several implementations of non-metric MDS
2005 Sep 22
1
multidimensional (smoothing) splines
Hi,
I am approximation a value function (in dynamic programming) V:
R^n->R. In different versions of the problem, n is between 2 and 5.
I would like to use splines to use this, I checked the mailing list
and CRAN but couldn't find anything that would help me (Tps in fields
is too slow, cobs would be really nice but seems to be
one-dimensional). Is there any package that would at least
2009 Oct 06
0
Kernlab: multidimensional targets in rvm(), ksvm(), gausspr()
Hi there,
I'm trying to do a regression experiment on a multidimensional
dataset where both x and y in the model are multidimensional
vectors.
I'm using R version 2.9.2, updated packages, on a Linux box.
I've tried gausspr(), ksvm() and rvm(), and the models are
computed fine, but I'm always getting the same error message
when I try to use predict():
"Error in
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:
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
2009 Jun 10
1
Analisys in Multidimensional contingency tables
Dear R-list,
Hi everyone, Im trying to make an analysis of multidimensional contingency
tables using R. I' working with the Agresti example where you have the
data from 3 categories. The thing is how can I do the analisys using the
G2 statistics. Somebody can send me an Idea?
I attach the program where you can find the data.
Best Regards,
> prob1<-
2001 Apr 02
1
Multidimensional Scaling
Hi
Does anyone know if there's a package I can use to do Multidimensional
scaling ?
Thank's
EJ
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at