similar to: How to apply a function to a multidimensional array based on its indices

Displaying 20 results from an estimated 400 matches similar to: "How to apply a function to a multidimensional array based on its indices"

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 <-
2010 May 17
2
retrieving last R output
Hello. I ran a simulation that took a few days to complete, and want to analyze the results, but have just realized that I (idiotically) did not assign the output to a variable when I intitiated the simulation. Is there any way to retrieve the last output produced by R so that these last few days were not a waste? Thank you very much. -- View this message in context:
2010 Jul 19
2
problems with plot()
I have a list of vectors of length 2, each representing a point in 2-space, and each of which I wish to plot on the current plot. In a loop, I assign the x and y coordinates of the current element of the list to variables 'x' and 'y' respectively, then make a call to plot as follows: par(new = TRUE) plot(x,y, xlim = c(0,1),ylim=c(0,1), xlab <- "x", ylab <-
2012 May 15
1
Odd behaviour of identical()
Consider the following code: test <- function(n) { for(x in 1:n) { for(y in 1:n) { for(r in max(x-1,1):min(x+1,n)) { for(s in max(y-1,1):min(y+1,n)) { vec <- c(x-r,y-s) print(c("vec = ", vec)) print(identical(vec,c(0,0))) } } } } } If you run test(2) you'll see a printout of the values
2010 Jul 06
2
Odd subsetting behaviour
Hello. I've observed some odd behaviour. Most likely, it is already known and explained somewhere, but I can't find an explanation anywhere, so I would appreciate being pointed in the right direction. The issue with the following code is self explanatory: > mat <- matrix(c(c(1,1,1),c(2,2,2)),nrow=3) > mat[,c(1:3%/%2)] [,1] [,2] [1,] 1 1 [2,] 1 1 [3,] 1 1
2009 Nov 21
4
title problem
Hi, I got problem in using title function to create a title for multiple plots presented together by par. As can be seen in the attached file, the title is displayed truncated and the subtitle doesn't get displayed. Here is the code: par(mfrow = c(1,2)) plot(c(1,2,3), c(9,8,7)) plot(c(1,2,3), c(9,8,7)) title(main = "Main title", sub ="Sub title",outer = TRUE,
2016 Feb 29
4
Juntar dos data.frames eliminando celdas con NA
Hola a todos, Quisiera juntar las informacion de dos data.frames con una union de columnas un tanto especial. La informacion que tengo son datos de captura-recaptura de diferentes individuos, por ejemplo en una base de datos tengo:ID <- c(1,2,3,4)Fate_1 <- c(2,2,2,2)Fate_2 <- c(0,0,0,NA)Fate_3 <- c(0, NA, NA, NA) y en otra base de datos tengo:ID <- c(1,2,3)Fate_1 <- c(0, 0, 0,
2006 Jul 28
0
Non-metric Multidimensional Scaling in R (Tobias Verbeke)
The vegan package has non-metric multidimensional scaling in addition to a variety of other ordination techniques. Regards, Helen Mills Poulos Yale University
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
2007 Nov 05
0
multidimensional integration with adapt
Hello, I apologize for eventual double-posting. I am trying to integrate a 2-dimensional function that already calls the function adapt. More precisely, I am calling adapt(2,lower=c(-100,-100),upper=c(100,100),functn=function(s){1-exp(-50*Unc enteredGauss(c(-10,10,-10,10),60,s)}) where UncenteredGauss is given by the following code in R:
2002 Dec 18
0
Multidimensional quadrature using "integrate"
Hi: I was wondering if someone could give me some examples of how to use the "integrate" function to perform multi-dimensional quadrature? I have a posterior density (up to a constant), for which I'd like to evaluate the normalizing constant. thanks for any help, Ravi.
2007 May 18
1
initializing a multidimensional array..
i have a plain old array initialized like this: @columns = Array.new this array needs to be an array of arrays.. how do i tell ruby that this is an array of arrays? what i want to do is something like this: @columns[i] << ''some value'' where is is determined programattically.. obviously, ruby won''t let me do this since @columns[i] is not an array, but an
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<-
2007 May 20
0
Testing multidimensional random numbers?
Dear Statistics-Experts, Assume you have given a new and untested pseudo-random number generator (prng) and you want to test if it "works". The distribution function (cdf) from which the prng is supposed to sample is known. Further, you are given some finite (large) sample from the prng. If the sample is one-dimensional, we can apply the cdf to it and test the sample for being
2005 May 12
0
Multidimensional Scaling with pairwise Fst
I want to create a MDS plot with pairwise Fst values derived from a population genetics project. My Fst values are in a tab-delimited file (lower triangle only) that I view with Excel. When I use the cmdscale command I get the message: Error in cmdscale(x) : Distances must be result of dist or a square matrix In addition: Warning messages: 1: "^" not meaningful for factors in:
2012 Oct 23
0
multidimensional Array or Hash with group_by 'created_at'
Hello, i want to create a multidimensional Array or Hash with group_by ''created_at''. 3 dimensions needed: myArray[week][day][data] currently i only created it with 2 dimesions: #model def self.group_per_day all.group_by{|t| t.created_at.strftime("%d. %B, %Y")}.sort #"%U" for Weeks end #controller @pdf_activities = Activity.group_per_day #view
2006 Feb 16
0
Hybrid Multidimensional Scaling
Hi all, Does anyone know if there's R code available for doing Hybrid Multidimensional Scaling (or Semi-Strong HMDS, e.g. Belbin 1991 J. Veg. Sci. 2:491-)? I've found only commercial software that does it. Thanks, Anni
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
2007 Aug 15
1
Function for reading in multidimensional tables / data.frames
Hi, I was wondering if there is already some function implemented into R that reads in tables with more than 2 dimensions. There is probably something neat out there... Thanks, Werner Wissenswertes zum Thema PC, Zubeh?r oder Programme. BE A BETTER INTERNET-GURU! www.yahoo.de/clever