search for: dims

Displaying 20 results from an estimated 4248 matches for "dims".

Did you mean: aims
2014 Nov 15
1
Error "promise already under evaluation ..." with function(x, dim=dim(x))
I've meant to ask the following for several years now. I understand why: > foo <- function(x, dim=dim) { dim } > foo(1) Error in foo(1) : promise already under evaluation: recursive default argument reference or earlier problems? gives an error, but why wouldn't/couldn't the following work? > foo <- function(x, dim=dim(x)) { dim } > foo(1) Error in foo(1) :
2014 Nov 24
1
Error "promise already under evaluation ..." with function(x, dim=dim(x))
On Sat, Nov 15, 2014 at 1:47 AM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote: > > On 14/11/2014, 9:06 PM, Henrik Bengtsson wrote: > > I've meant to ask the following for several years now. I understand why: > > > >> foo <- function(x, dim=dim) { dim } > >> foo(1) > > Error in foo(1) : > > promise already under evaluation:
2008 Jul 30
1
model mix problem. FALSE CONVERGENCE
Hi R users I try to use the lme but I can?t!!!!! My script is (some words in french, sorry!!): rm(list=ls(all=TRUE)) #Efface tous les objets en m?moire pour ?viter des erreurs library(MASS) #Chargement des Librairies library(car) library(Hmisc) library(tkWidgets) library(svDialogs) library(multtest) library(nlme) #Rep <- "C:/Documents and Settings/U3M/Bureau/steph/Scripts
2023 Oct 29
1
dim<-() changed in R-devel; no longer removing "dimnames" when doing dim(x) <- dim(x)
Hello, the fix of PR18612 (https://bugs.r-project.org/show_bug.cgi?id=18612) in r85380 (https://github.com/wch/r-source/commit/2653cc6203fce4c48874111c75bbccac3ac4e803) caused a change in `dim<-()`. Specifically, in the past, any `dim<-()` assignment would _always_ remove "dimnames" and "names" attributes per help("dim"): The replacement method changes
2023 Oct 30
2
dim<-() changed in R-devel; no longer removing "dimnames" when doing dim(x) <- dim(x)
>>>>> Henrik Bengtsson >>>>> on Sun, 29 Oct 2023 10:42:19 -0700 writes: > Hello, > the fix of PR18612 > (https://bugs.r-project.org/show_bug.cgi?id=18612) in > r85380 > (https://github.com/wch/r-source/commit/2653cc6203fce4c48874111c75bbccac3ac4e803) > caused a change in `dim<-()`. Specifically, in the past,
2023 Oct 31
1
dim<-() changed in R-devel; no longer removing "dimnames" when doing dim(x) <- dim(x)
Hi Martin, Henrik, I actually like this change. Makes a lot of sense IMO that dim(x) <- dim(x) be a no-op, or, more generally, that foo(x) <- foo(x) be a no-op for any setter/getter combo. FWIW S4Arrays::set_dim() does that too. It also preserves the dimnames if the right value is only adding or dropping outermost (ineffective) dimensions: ??? > x <- array(1:6, dim=c(2,3,1),
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]
2006 Jul 27
2
Vector extracted from a matrix. How can I specify dimensions in as.matrix?
Transpose vector extracted from a matrix Hello, I am doing a recursive analysis that uses every line (vector) of a matrix in a loop. In the model, I need to transpose those vectors that are extracted from a matrix. Using simple vectors (no matrix involved) the transpose function works fine: simplevector <-matrix(1:3,3,1) tsimplevector <-t(simplevector) #transposed dim(simplevector)
2005 Apr 21
2
apply vs sapply vs loop - lm() call appl(y)ied on array
Christoph -- There was just a thread on this earlier this week. You can search in the archives for the title: "refitting lm() with same x, different y". (Actually, it doesn't turn up in the R site search yet, at least for me. But if you just go to the archive of recent messages, available through CRAN, you can search on refitting and find it. The original post was from William
1999 Mar 25
1
Question about Structure
...1 3 5 [2,] 2 4 6 > structure(1:6, dim= 3:2) [,1] [,2] [1,] 1 4 [2,] 2 5 [3,] 3 6 > structure(1:2, dim= 1:2) [,1] [,2] [1,] 1 2 > structure(1:2, dim= 2:1) [,1] [1,] 1 [2,] 2 > structure(1:3, dim= 3:1) Error: dim<- length of dims do not match the length of object > structure(1:3, dim= 1:3) Error: dim<- length of dims do not match the length of object > structure(1:4, dim= 2:2) Error: dim<- length of dims do not match the length of object > structure(1:4, dim= 1:4) Error: dim<- length of dims do not match t...
2006 Jun 10
3
sparse matrix, rnorm, malloc
...answer to my question below. I'm trying to generate very large sparse matrices (< 1% non-zero entries per row). I have a sparse matrix function below which works well until the row/col count exceeds 10,000. This is being run on a machine with 32G memory: sparse_matrix <- function(dims,rnd,p) { ptm <- proc.time() x <- round(rnorm(dims*dims),rnd) x[((abs(x) - p) < 0)] <- 0 y <- matrix(x,nrow=dims,ncol=dims) proc.time() - ptm } When trying to generate the matrix around 20,000 rows/cols on a machine with 32G of memory, t...
2005 Jan 21
6
dim vs length for vectors
Hi all, I'm not sure if this is a feature or a bug (and I did read the FAQ and the posting guide, but am still not sure). Some of my students have been complaining and I thought I just might ask: Let K be a vector of length k. If one types dim(K), you get NULL rather than [1] k. Is this logical? Here's the way I explain it (and maybe someone can provide a more accurate
2005 Jul 07
2
Brewer colours
Anyone who is interested in using optimal colour palettes should look at the work of Cindy Brewer: www.colorbrewer.org I have written code to use her colour schemes in R. It is included below. Perhaps someone may find this interesting enough to work into a package. Included also is a function showpalette, which was posted here a while back. I don't remember who wrote it. I have copied all
2005 May 07
4
how to add method to .Primitive function
Hi, I tried to write the dim method for the list class, but R doesn't seem to dispatch to it: > dim.list = function(x) c(length(x[[1]]), length(x)) > dim(list(1)) NULL > dim.list(list(1)) [1] 1 1 What is the correct way of registering dim.list with .Primitive("dim")? Thanks, Vadim [[alternative HTML version deleted]]
2012 Oct 23
1
[LLVMdev] Clang fails to compile template with dependendent Non type template parameter.
Hi All, I'm trying to compile the following code on clang- template <int dim> class X {}; template <class T> struct Y { static const unsigned int dim = 1 ; template <class U> X<Y<T>::dim> f(); }; template <class T> template <class U> X<Y<T>::dim> Y<T>::f() { return X<dim>(); } int main() { Y<int>().f<int>();
2010 Oct 21
4
Efficient nested loops
Dear R community, I am working with huge arrays, so I spend a lot of time computing. This is my code: for (x in 1:dim(variable)[1]){ for (y in 1:dim(variable)[2]){ for (z in 1:dim(variable)[3]){ result <- max(variable[x,y,z,]) } } } Is there a more efficient procedure to do this task? Thanks in advance! [[alternative HTML version deleted]]
2012 Oct 16
2
Penalty function constrained optimization
Hi All, I am trying to use optim() to minimize a function with a penalty function term. This is a simple model bioeconomic model of a fishery. The penalty function constrains the amount of effort (f) at 9. This works fine. The code is: ********** nfleets<-2 M<-1 M<-array(M,dim=c(nfleets)) N<-1000 cost<-c(30,30) cost<-array(cost,dim=c(nfleets)) Price<-2
2017 Feb 09
2
[Release-testers] [4.0.0 Release] Release Candidate 2 has been tagged
On Thu, Feb 9, 2017 at 2:23 PM, Dimitry Andric <dimitry at andric.com> wrote: > On 9 Feb 2017, at 01:33, Hans Wennborg via Release-testers <release-testers at lists.llvm.org> wrote: >> >> 4.0.0-rc2 was just tagged from the branch at r294535. > > Building on FreeBSD 10 at least didn't crash this time, and lld built just fine. :) I uploaded the following: >
2018 Aug 31
2
Argument 'dim' misspelled in error message
Hi, The following error message misspells the name of the 'dim' argument: > array(integer(0), dim=integer(0)) Error in array(integer(0), dim = integer(0)) : 'dims' cannot be of length 0 The name of the argument is 'dim' not 'dims': > args(array) function (data = NA, dim = length(data), dimnames = NULL) NULL Cheers, H. -- Herv? Pag?s Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cance...
2008 Sep 10
1
Return dimension index from array with n-dimensions
...to comment the function I wrote. Hopefully resulting in the integration of such a function in a R-packages. Kind regards, Niels Hintzen #Example: a <- array(100:1,dim=c(5,4,5)) which(a == 7) nindex(a,7) nindex<-function(array.,index.){ dims <- dim(array.) ldim <- length(dim(array.)) dimmy <- matrix(NA,ncol=length(index.),nrow=ldim) remain <- matrix(NA,ncol=length(index.),nrow=ldim) remain[1,] <- index. for(i in 1:(length(dims)-1)){...