similar to: do.call() and aperm()

Displaying 20 results from an estimated 4000 matches similar to: "do.call() and aperm()"

2004 Mar 18
12
substitute question
Consider the following example: # substitute a with b in the indicated function. Seems to work. > z <- substitute( function()a+1, list(a=quote(b)) ) > z function() b + 1 # z is an object of class call so use eval # to turn it into an object of class expression; however, # when z is evaluated, the variable a returns. > eval(z) function()a+1 Why did a suddenly reappear again
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
2012 Mar 13
1
Visualising multiple response contingency tables
Dear R Help Community, I have a question and an answer (based on reading this forum and online research), but I though I should share both since probably there's a much better way to go about my solution. My question is specifically about how to best visualise multiple response contingency tables. What I mean by 'multiple response' is that the total number of responses per row of a
2004 Jul 28
6
elegant matrix creation
Hello everybody. I am trying to reproduce a particular matrix in an elegant way. If I have jj1 <- structure(c(1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2, 3,1,2,3,1,2,3,1,2,3,2,3,1,2,3,1,2,3,1,2,3, 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,3,1,2,3,1, 2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1, 2),.Dim = as.integer(c(9,9))) [ image(jj1) is good here ] then I can get this with
2004 Oct 01
2
multiple dimensional diag()
Hi I have two arbitrarily dimensioned arrays, "a" and "b", with length(dim(a))==length(dim(b)). I want to form a sort of "corner-to-corner" version of abind(), or a multidimensional version of blockdiag(). In the case of matrices, the function is easy to write and if a=matrix(1,3,4) and b=matrix(2,2,2), then adiag(a,b) would return: [,1] [,2] [,3] [,4] [,5]
2003 Oct 08
6
Why does a[which(b == c[d])] not work?
Dear list, I can not understand why the expression in the subject does not work correct: > dcrn[which(fn == inve[2])] numeric(0) > inve[2] [1] 406.7 > dcrn[which(fn == 406.7)] [1] 1.3994e-07 1.3988e-07 1.3953e-07 1.3966e-07 1.3953e-07 1.3968e-07 Is this a kick self problem or an bug? Thaks very much Thomas
2003 Oct 17
7
datetime data and plotting
If I take the following simple data: YEAR MONTH DAY WEIGHT.KG 2003 10 6 1.2 2003 10 12 1.2 2003 10 16 1.3 and format the date data and plot it: dates <- strptime(paste(DAY,MONTH,YEAR),"%d%m%Y") plot(c(min(dates),max(dates)),c(0,max(WEIGHT.KG)), xlab="Date",ylab="Weight (kg)",type="n") lines(dates,WEIGHT.KG) points(dates,WEIGHT.KG) I find that the
2006 Nov 23
2
loading libraries on MPI cluster
Dear R-users, we are using library(snow) for computation on a linux cluster with RMPI. We have a problem with clusterEvalQ: after launching clusterEvalQ it seems loading the required library on each node but if we type a function belonging to the loaded package R doesn't find it. > library(snow) # making cluster with 3 nodes > cl <- makeCluster(3, type = "MPI") Loading
2005 Apr 21
1
Installing packages from source code
Hi everybody, I have trouble in installing packages from source code by following Section 5.1 in manual R-admin.pdf . I am using R 2.1.0 and Win NT. Following the Windows toolset section in the manual, I download the tool set package from: http://www.murdoch-sutherland.com/Rtools/tools.zip and unzip under C:\tools I also downloaded Perl (Windows Port) and installed it.
2004 Jan 14
2
automatic "paste" filter to paste only the commands from a transcript on the clipboard
Just for fun (and actually because I would use it too) I wrote a version of the "paste" menu command that assumes the clipboard contains a transcript, and just pastes the commands from it into the R console window (Windows GUI only). So, if something like this: > foo <- + 33 > foo * 3 [1] 99 > foo [1] 33 is on the clipboard, then the "paste commands" menu
2003 Oct 23
3
what's going on here with substitute() ?
I was trying to create a function with a value computed at creation time, using substitute(), but I got results I don't understand: > this.is.R Error: Object "this.is.R" not found > substitute(this.is.R <- function() X, list(X=!is.null(options("CRAN")[[1]]))) this.is.R <- function() TRUE > # the above expression as printed is what I want for the
2011 Aug 12
1
install packages from intranet
Hi, I'm new to R. Apologies if this is a simple query, I've searched the mailing lists and docs but can't find a solution to my problem. I'm trying to make some packages available on our intranet. During development the 'intranet' is a webserver running on localhost. * When I call "install.packages" I get a mesage about not being able to access 'index
2002 Oct 10
2
tapply for matrices
Does anyone have something like tapply that is extremely fast for matrices when there is a very large number of levels of the grouping variable? I'm referring to, for example, tapply(x, grouping.variable, function.operating.on.submatrix) where x is a matrix and the submatrix is a subset of the rows of x. The grouping variable's length equals the number of rows of x. -- Frank E
2004 Jun 04
5
How to Describe R to Finance People
> the main advantage it has over SPSS-like software is that you do not > need to explicitly create dummy variables. You only need to specify > your dependent variable and independent variables and R will fit it > (and create dummy variables automatically) for you. Does the audience know exactly what the creation of dummy variables in SPSS is and means? If not, they might consider
2005 Oct 21
1
Generalised rbind/cbind
Dear list, Is there a generalised form of rbind/cbind for combining matrices/arrays into higher-D structures? ie. if I have: a <- matrix(2,2,2) b <- matrix(3,2,2) how can I get array(rep(c(3,2), each=4), c(2,2,2)) ? It seems like this would be the job of a generalised abind function: abind(a,b, along=1) == rbind(a,b) abind(a,b, along=2) == cbind(a,b) abind(a,b, along=3)
2002 Mar 13
1
several bugs (PR#918) lists and matrices
### I got bit again by the same bugs I wrote about a year ago. ### The bugs are related to matrices and arrays of lists. ### 1. There is a clear inconsistency in how R handles two ### functionally equivalent statements. ### array() is able to take a list and create a matrix. ### matrix() is unable to create that matrix. > vector("list", 2) [[1]] NULL [[2]] NULL >
2005 Jun 09
1
single assignment affecting multiple sub-structures (PR#7924)
I'm trying to create a language structure that is a call to a function with a number of arguments that is only known at run time. I do this by using repeated indices to expand out a call with a single argument. However, when I change one of the arguments, all are changed. I don't see the same behavior when I initially create a call with multiple arguments. Even more strangely,
2011 Jan 20
1
syntax for a list of components from a list
I'm attempting to generalise a function that reads individual list components, in this case they are matrices, and converts them into 3 dimensional array. I can input each matrix individually, but want to do it for about 1,000 of them ... This works array2 <- abind(list1[[1]],list1[[2]],list1[[3]],along=3) This doesn't array2 <- abind(list1[[1:3]],along=3) This doesn't either
2008 Oct 16
1
packages in Depends field and NAMESPACES
Must packages in the Depends field of the DESCRIPTION file have NAMESPACES? I haven't seen this explicitly indicated anywhere. I am writing a small package and find that when I add the abind package to the list of the Depends field, I get an error in R CMD check of the build. * checking package name space information ... OK * checking package dependencies ... ERROR Packages required but not
2009 Oct 19
1
rbind to array members‏
(resent as hotmail really cannot format plaintext, but I've just read Tony Plate's message that what I'd like to do might not be possible) > > library(abind) ## array binding I've looked into using abind() but it seems I might not understand it properly. I can build my 2 table array and insert a row into each table using: x <- array(0,c(1,3,2)) x[,,1]