Displaying 20 results from an estimated 1984 matches for "dimnamed".
Did you mean:
dimnames
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,
2012 Aug 13
4
dimnames in an array(I'll be grateful if this message will be passed to all list users)
Hello,
I'm hoping someone with a wide experience with R may be able to see
what the program is trying to tell me.
I've got an array:
y1=rnorm(41,0.2)
y2=rnorm(41,0.2)
y3=rbind(y1,y2)
data11<-array(0,c(41,2,2))
data11[,1,]=y3
data11[,2,]=y3
rownames(data11)<-rownames(data11, do.NULL = FALSE, prefix = "Obs.")
colnames=c("V","R")
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),
2020 Feb 19
3
dimnames incoherence?
Hi,
I was bitten by a little incoherence in dimnames assignment or may be I
missed some point.
Here is the case. If I assign row names via dimnames(a)[[1]], when
nrow(a)=1 then an error is thrown. But if I do the same when nrow(a) > 1
it's OK. Is one of this case works unexpectedly? Both? Neither?
a=as.matrix(1)
dimnames(a)[[1]]="a" # error: 'dimnames' must be a list
2004 Sep 27
8
cannot assign dimnames
Dear list,
If anyone knows how to assign dimnames to matrices or arrays I would be most
grateful for help. I've tried various permutations of likely-looking code
but get error messages every time. I could find no example in the
documentation.
Many thanks,
Dan Bebber
Department of Plant Sciences
University of Oxford
South Parks Road
Oxford OX1 3RB
UK
Tel. 01865 275000
2007 Dec 18
4
accessing dimension names
I have a matrix y:
> dimnames(y)
$x93
[1] "1" "2"
$x94
[1] "0" "1" "2"
.................. so on (there are other dimensions as well)
I need to access a particular dimension, but a random mechanism tells me
which dimension it would. So, sometimes I might need to access
dimnames(y)$x93, some other time it would be dimnames(y)$x94.. and so
2005 Oct 15
1
drop() and "["(), and apply()
I have two queries about the behaviour of drop() and apply() regarding the
dimnames and names(dimnames) of the answer. I would appreciate any
comments on this behaviour. I will submit any of this as a bug report if I
am encouraged to do so.
The first query, concerning drop(), seems to me to be a bug in ?drop, and
possibly also in the function.
?drop:
[...] Any accompanying 'dimnames'
2015 Dec 17
1
array() ignores illegal non-list dimnames
Is there a reason that array() silently ignores dimnames that are not
a list but matrix() gives an error?
> str(matrix(11:14, 2, 2, dimnames=c("Rows","Cols")))
Error in matrix(11:14, 2, 2, dimnames = c("Rows", "Cols")) :
'dimnames' must be a list
> str(array(11:14, dim=c(2, 2), dimnames=c("Rows","Cols")))
int
2001 Aug 07
1
cannot assign to NULL dimnames (PR#1042)
Full_Name: Hsiu-Khuern Tang
Version: 1.3.0
OS: GNU/Linux (Debian unstable)
Submission from: (NULL) (192.6.19.124)
Hi all,
I am not sure this is a bug rather than an intentional design, but here
goes:
If I do
> a <- matrix(1:4, nrow=2)
> dimnames(a)[[1]] <- c("a", "b")
I get the following error message because dimnames(a) is NULL:
Error: more elements
2008 Jan 04
3
slow access to matrix dimnames
hello,
i have been trying to convert my data frames to matrices in the hopes of
speeding up some of my more complicated scripts.
to assist with this, i am trying to create a "matrix column operator"
like $:
"%$%" = function(data,field) {
as.numeric(data[,grep(field,unlist(dimnames(data)[2]))])
}
the idea here is that you can use a matrix like a dataframe:
2012 Nov 15
4
Selecting the "non-attribute" part of an object
I have two matrices, generated by R functions that I don't understand.
I want to confirm that they're the same, but I know that they have
different attributes.
If I want to compare the dimnames, I can say
> identical(attr(tm, "dimnames"), attr(tmm, "dimnames"))
[1] FALSE
or even:
> identical(dimnames(tm), dimnames(tmm))
[1] FALSE
But I can't find any
2020 Feb 19
2
dimnames incoherence?
>>>>> Martin Maechler
>>>>> on Wed, 19 Feb 2020 18:06:57 +0100 writes:
>>>>> Serguei Sokol
>>>>> on Wed, 19 Feb 2020 15:21:21 +0100 writes:
>> Hi,
>> I was bitten by a little incoherence in dimnames assignment or may be I
>> missed some point.
>> Here is the case. If I assign row names
2017 Jun 01
2
subletting an array according to dimnames
Hi all,
I have a three dimensional array with the corresponding dimension names.
I would like to subset the array according to the dimension names. For
example,
suppose I want to extract the values corresponding to A=20, B=10, C=0. I
know I
can do:
P2[dimnames(P2)$A==20, dimnames(P2)$B==10, dimnames(P2)$C==0]
But is there a better way for doing this? Thanks for your help!
Hanna
>
2009 May 17
1
[wishlist, patch] make row() and col() preserve dimnames (PR#13705)
Full_Name: Ben Goodrich
Version: 2.9.0
OS: Linux (Debian unstable)
Submission from: (NULL) (128.103.220.16)
row(x), col(x), and functions that call them like lower.tri(x) and upper.tri(x)
do not retain the rownames or colnames of x in the matrix that is returned.
Example from R version 2.9.0 :
x <- matrix(1:9, nrow = 3, ncol = 3)
rownames(x) <- LETTERS[1:3]
colnames(x) <- letters[1:3]
2011 Apr 20
1
Error in dimnames(x) for Poisson EWMA model
I am attempting to run a Poisson EWMA model using Patrick Brandt's source code. I get the following error when I run the code:
Error in dimnames(x) <- dn :
length of 'dimnames' [1] not equal to array extent
Dimnames(x) looks like this:
[[1]]
NULL
[[2]]
[1] "mip" "div" "nom" "unity" "mood"
2010 Aug 23
3
extracting p-values from Anova objects (from the car library)
Dear all,
is there anyone who can help me extracting p-values from an Anova object
from the car library? I can't seem to locate the p-values using
str(result) or str(summary(result)) in the example below
> A <- factor( rep(1:2,each=3) )
> B <- factor( rep(1:3,times=2) )
> idata <- data.frame(A,B)
> fit <- lm( cbind(a1_b1,a1_b2,a1_b3,a2_b1,a2_b2,a2_b3) ? sex,
2011 May 16
1
Extracting the dimnames of an array with variable dimensions
Hi list,
In a function I am writing, I need to extract the dimension names of
an array. I know this can be acheived easily using dimnames() but my
problem is that I want my function to be robust when the number of
dimensions varies. Consider the following case:
foo <- array(data = rnorm(32), dim = c(4,4,2),
dimnames=list(letters[1:4], LETTERS[1:4], letters[5:6]))
# What I want is to extract
2012 Aug 08
1
dimnames in array
Hello,
I'm working with an array; I'm trying to make it so that an array of
dim(42,2,2) has names whose length corresponds to that of the array,
and am hoping someone with experience with this can see what I'm not
doing correctly:
data11 = array(0,c(41,2,2))
y = lsoda(x0,times,fhn$fn.ode,pars)#This is make.fhn() from colloc
infer package#
y = y[,2:3]
2005 Dec 08
1
kronecker(... , make.dimnames=TRUE)
Hi
I'm using kronecker() with a matrix and a vector. I'm interested in
the column names that kronecker() returns:
> a <- matrix(1:9,3,3)
> rownames(a) <- letters[1:3]
> colnames(a) <- LETTERS[1:3]
> b <- c(x=1,y=2)
> kronecker(a,b,make.dimnames=TRUE)
A: B: C:
a:x 1 4 7
a:y 2 8 14
b:x 2 5 8
b:y 4 10 16
c:x 3 6 9
c:y 6 12 18
>
The