Displaying 20 results from an estimated 200 matches similar to: "Dimnames of array inside loop"
2009 Jan 14
0
error about dimnames...
I have data from spss imported to R.
I did the SEM analysis but the result says
Error in dimnames(x) <- dn :
length of 'dimnames' [2] not equal to array extent
I start with the covariance matrix then, specify.model(), then ram, then params, then vars, then finally the SEM.
No result will come out because of the dimnames error.
How to go about this?
Can anyone help me with
2007 May 13
0
Error in dimnames(x) <- dn
Hi everyone,
I import data from access, and make an object (c) store the data,
when I want to use it in function mnp, it gives the below error:
Error in dimnames(x) <- dn : length of 'dimnames' [2] not equal to array
extent
> x<-odbcConnectAccess("db2.mdb")
> c<-sqlFetch(x,"Sheet2")
> odbcClose(x)
> c
choice clio punto polo
1
1997 Jul 15
0
R-beta: dimnames(obj)[..] <- .... works in S but not in R
The following is a minor incompatibility R <-> S
which may be worth putting on the TASKS list :
-- Martin Maechler
###--- The following code only works in S, but not in R :
##-- Example 1 : dimnames(..)[.] <- list(...)
## ===
ma <- cbind(1,1:4)
dimnames(ma)[2] <- list(c("x","y"))
ma
##- x y
##- [1,] 1 1
##- [2,] 1 2
2017 Jun 02
0
subletting an array according to dimnames
Have you tried P2["20", "10", "0"] ?
Jean
On Thu, Jun 1, 2017 at 3:10 PM, li li <hannah.hlx at gmail.com> wrote:
> 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,
1997 Nov 28
0
R-alpha: "..." arg.matching [was 'Problems with dimnames and names']
> -- Now to the ``real'' one : --
>
> Martyn> 3) I have no idea what's going on here.
>
> >> c(r=1,s=2)
> Martyn> s
> Martyn> 2
> >> c(u=100,b=4)
> Martyn> b
> Martyn> 4
>
> Martyn> This seems to happen only for "r" and "u". Other single-letter
> Martyn> names
1999 Oct 08
1
dimnames and subscripting (PR#293)
I am not sure that this is a bug, but it was unexpected -- of course my
expectations are fallible, eg column ordering in model.matrix()! When an
array is subscripted the names of the dimnames list are lost (v 64.1).
fred <- array(1:12, 2:4, list(A = letters[1:2], B = letters[3:5], C =
letters[6:9]))
dimnames(fred)
dimnames(fred[1, , ])
dimnames(fred[1, , , drop=FALSE])
In the first
2003 Jan 30
0
empty array indexing with dimnames -> erroneous error (PR#2507)
This is a bug that will not often trigger, and only happens for arrays
(but not matrices) ending up with 0 dimensions:
The following code also shows two 'buglets' (the first even for
matrix indexing) where "drop = TRUE/FALSE" is not correctly obeyed.
One can argue that since all these arrays have length zero, it
shouldn't matter what dimensions they get.
[But this
2006 May 12
1
Dropping dimnames doesn't matter (anymore)?
In the "old days", one way of speeding up matrix calculations was to
drop the dimnames of the matrices prior to the calculations, i.e.,
dimnames(X) <- NULL. I distinctly remember that this could have a
great impact at least in Splus 3.x (under UNIX/Linux).
I just did a small, informal test of this with a couple of functions I
use to fit plsr models, in R 2.3.0 (Linux). It
2008 Dec 03
1
Matrix dimnames crash (PR#13361)
In Windows XP, the matrix() function crashes the program when 'dimnames'
is an empty list:
matrix(1:4, nrow=2, dimnames=list())
# R has encountered a problem and needs to close ...
This bug is specific to WinXP, as Linux64 handles this situation more
gracefully:
matrix(1:4, nrow=2, dimnames=list())
Error in matrix(1:4, nrow = 2, dimnames = list()) :
invalid type
2012 Jun 05
1
length-0 list as dimnames
Hi,
I'm working on a package and observed a behaviour that was suggested
to be incompatible with the documentation.
The code below:
x <- matrix(1:4, 2)
dimnames(x) <- list()
works just fine. But checking the documentation for dimnames(), it
states that if value is a list "its components are either 'NULL' or a
character vector with positive length of the appropriate
2015 Apr 30
0
dimnames returned by function apply
>>>>> Fischer, Bernd <b.fischer at dkfz-heidelberg.de>
>>>>> on Wed, 29 Apr 2015 20:22:44 +0200 writes:
> Dear all,
> I noticed that the dimnames returned by apply are different in the new release.
> In the following example. The returned row-names are c(?S?,?T?), but shouldn?t they be c(?X?,?Y?) as in the old release?
Not quite :
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
2016 Jun 10
0
collapsing list of NULLs dimnames into a NULL
Hi,
Here are two different ways to create a 0 x 0 logical matrix:
m1 <- matrix(nrow=0, ncol=0)
m1
# <0 x 0 matrix>
m2 <- as.matrix(data.frame())
m2
# <0 x 0 matrix>
Surprisingly:
identical(m1, m2)
# [1] FALSE
That's because of their dimnames:
dimnames(m1)
# NULL
dimnames(m2)
# [[1]]
# NULL
#
# [[2]]
# NULL
More
2017 Jun 06
0
surprisingly, S4 classes with a "dim" or "dimnames" slot are final (in the Java sense)
Thanks for the report. The issue is that one cannot set special attributes
like names, dim, dimnames, etc on S4 objects. I was aready working on this
and will have a fix soon.
> a2 <- new("A2")
> dim(a2) <- c(2, 3)
Error in dim(a2) <- c(2, 3) : invalid first argument
On Mon, Jun 5, 2017 at 6:08 PM, Herv? Pag?s <hpages at fredhutch.org> wrote:
> Hi,
>
>
2017 Dec 22
0
Unexpected dimnames attribute returned by cbind/rbind
Hi,
> m5 <- cbind(integer(5), integer(5))
> m5
[,1] [,2]
[1,] 0 0
[2,] 0 0
[3,] 0 0
[4,] 0 0
[5,] 0 0
> dimnames(m5)
NULL
No dimnames, as expected.
> m0 <- cbind(integer(0), integer(0))
> m0
[,1] [,2]
> dimnames(m0)
[[1]]
NULL
[[2]]
NULL
Unexpected dimnames attribute!
2020 Feb 19
0
dimnames incoherence?
>>>>> 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 via dimnames(a)[[1]], when
> nrow(a)=1 then an error is thrown. But if I do the same when nrow(a) > 1
>
2001 Sep 13
1
rowsum dimnames
Hi,
The result of rowsum() in R doesn't have the dimnames I'd expect, e.g.:
> rowsum(matrix(1:12, 3,4), c("Y","X","Y"))
[,1] [,2] [,3] [,4]
1 2 5 8 11
2 4 10 16 22
whereas S-Plus gives the more useful result:
[,1] [,2] [,3] [,4]
X 2 5 8 11
Y 4 10 16 22
This is because R's rowsum() code gives
2002 Aug 07
2
indexing matrices with dimnames?
I've got a covariance matrix that I'd like to index using the
dimnames:
> vcov1
n0 x0 s n1 n2
n0 82.43824759 1.839505e-02 -4.975196e-01 2.882394e+03 -2.615986e-01
x0 0.01839505 6.134010e-03 -7.695922e-04 -6.373946e+01 6.086321e-03
s -0.49751964 -7.695922e-04 9.638943e-03 3.406594e+02 -3.173671e-02
n1 2882.39407745
2004 Nov 22
1
Left justification af dimnames in tables.
Hi helpeRs.
When I do two-ways tables dimnames in columns are almost left-adjusted:
<- factor(rbinom(30,1,.3),labels=c("first","second"))
> b <- a
> table(a,b)
b
a first second
first 21 0
second 0 9
If I do a oneway table however, dimnames are right-adjusted:
table(a)
a
first second
21 9
Actually I must admit I
2005 Feb 11
0
Subsetting using dimnames on S4 array-based class
Hello,
I am encountering some problems when overloading the "[" operator for a
new S4 class based on array. This is an example class definition:
setClass("foo",
representation("array"),
prototype(array(NA, dim=c(3,3)),
dimnames=list(age=1:3, year=10:12))
)
And this the corresponding setMethod with print estatements to see what
is being passed: