Displaying 20 results from an estimated 20000 matches similar to: "several bugs (PR#918) lists and matrices"
2001 Apr 23
1
several bugs (PR#918)
# Your mailer is set to "none" (default on Windows),
# hence we cannot send the bug report directly from R.
# Please copy the bug report (after finishing it) to
# your favorite email program and send it to
#
# r-bugs@r-project.org
#
######################################################
1. as.numeric behaves differently in R than in S and I think this
shows a bug in how S3
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 Oct 21
4
peculiar matrices
As far as I can tell from reading The Fine Documentation
(R Language Definition and Intro to R), matrices are supposed
to be of homogeneous types. Yet giving matrix() an inhomogeneous
list seems to work, although it produces a peculiar object:
v = list(1:3,4,5,"a")
m = matrix(v,nrow=2)
m
[,1] [,2]
[1,] Integer,3 5
[2,] 4 "a"
m[1,]
[[1]]
[1] 1 2 3
[[2]]
2000 Oct 27
1
Extracting vectors from matrices
There is probably a simple and obvious answer to this, so sorry for
wasting your time...
I have a matrix of predictions from an proportional odds model (using
the polr function in MASS), so the columns are the probabilities of the
responses, and the rows are the data points. I have another column with
the observed responses, and I want to extract the probabilities for the
observed responses.
As
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]
2014 Aug 06
2
Subscripting Matrices
There seems to be a result type difference when subscripting a 6 x 1
matrix as compared to a 3 x 2 matrix that is caused by the ncol = 1
compared to ncol > 1.
> ThinMatrix <- matrix(1:6,ncol=1)
> ThinMatrix
[,1]
[1,] 1
[2,] 2
[3,] 3
[4,] 4
[5,] 5
[6,] 6
> FatMatrix <- matrix(1:6,ncol=2)
> FatMatrix
[,1] [,2]
[1,] 1 4
[2,] 2 5
2009 Jul 29
1
Subtract matrices within arrays along indices
I have the following array: 3 dimensional object, one dimension being year.
Object is 3*3*3
library(plyr, reshape)
a1<-rep(c(2007,2008,2009),9)
a2<-c(rep("a",9),rep("b",9),rep("c",9))
a3<-c(rep(c(rep(1,3),rep(2,3),rep(3,3)),3))
a4 <- rnorm(27)
A<-data.frame(cbind(comp=a2,val=a3, year=a1, a4))
A1<-melt(A, id=c("year", "comp",
2012 Apr 17
3
Can a matrix have 'list' as rows/columns?
After a lot of processing I get a matrix into M. I expected each row and
column to be a vector. But it is a list.
R-Inferno says...
"Arrays (including matrices) can be subscripted with a matrix of positive
numbers. The subscripting matrix has as many columns as there are dimensions
in the array—so two columns for a matrix. The result is a vector (not an
array)
containing the selected
2007 Jan 12
2
image() and nonsquare matrices
How do I draw non-square matrices with image() and get the axes right?
Try 1:
a <- matrix(rnorm(100),20,5)
image(1:20,1:5,a,asp=1,xlab="label here")
# No good because the axes don't touch the image
Try 2:
image(1:20,1:5,a,asp=1,axes=F,xlab="label here")
axis(side=1,pos=0)
# No good because the x axis label is floating far from the x axis.
Try 3:
2005 Apr 13
2
extracting one element of correlation matrices from a list poroduced by the 'by' statement
I am producing 2X2 correlation matrices by a class variable. I need to
extract a vector of correlation coefficients only. I am doing that in a
loop (see below) but I am sure there would be a simpler way. Please
help!
> by(d1[,c(2,3)],d1[,1],cor)
d1[, 1]: 1
c e
c 1.0000000 0.1972309
e 0.1972309 1.0000000
2011 Dec 08
2
Relationship between covariance and inverse covariance matrices
Hi,
I've been trying to figure out a special set of covariance
matrices that causes some symmetric zero elements in the inverse
covariance matrix but am having trouble figuring out if that is
possible.
Say, for example, matrix a is a 4x4 covariance matrix with equal
variance and zero covariance elements, i.e.
[,1] [,2] [,3] [,4]
[1,] 4 0 0 0
[2,] 0 4
2009 Aug 18
2
Embedding lists in matrices and matrices in lists
Hi,
I'm new to programming, new to R and even new to mailing lists so please
be patient with me. I need to manage many matrices generated by an R
program. These matrices have different dimensions and I'd like to group
them somehow. The best way would be to have a big matrix (let's call it
database) where every element database[x,y] consists of a list of
matrices that all have the
2011 Sep 16
3
writing data from several matrices in R into one excel-file with several sheets
hello,
does anyone know how I can write several matrices from R into one exel-file
using different sheets for the different matrices?
thank you very much in advance for your help.
Marion
[[alternative HTML version deleted]]
2007 Nov 14
2
Generating these matrices going backwards
I have generated the following:
x=
E1 E2 E3
D1 0 0 1
D2 1 0 3
D3 0 2 0
y=
E1 E2 E3
D1 0 0 1.75
D2 1.75 0 1.3125
D3 0 3.5 0
Where x and y are linked by:
y =sum(x) * x / (rowSums(x)%o%colSums(x))
N=x[x[1:3,]>0]
R=y[y[1:3,]>0]
Now suppose I ONLY
2010 Sep 27
1
compare two matrices
Hi everyone:
I have a kinda easy question but i do not know how to solve that in a simple way.
I want to compare the rows of two matrices.
col1 <- c(1,2,3,4,5,6)
col2 <- c(6,5,4,3,2,1)
m <- cbind(col1, col2)
col3 <- c(1,3,2,6)
col4 <- c(6,3,5,1)
n <- cbind(col3, col4)
In matrix n, for example the first row is (1,6), it is also some row
2005 Sep 18
0
How to test homogeneity of covariance matrices?
Dear Group Members,
Forgive me if I am a little bit out of subject. I am looking for a good
way to test the homogeneity of two variance-covariance matrices using R,
prior to a Hotelling T test. Youll probably tell me that it is better
to use a robust version of T, but I have no precise idea of the
statistical behaviour of my variables, because they are parameters from
the harmonics of
2011 Dec 27
2
How to create a matrix with 3 dimensions from several 2 dimensional matrice?
Hi every one,
How is it possible to create a matrix with 3 dimensions from several 2
dimensional matrice?
Is it possible that each of "elementary/building block" matrices could be
called by its corresponding original name?
Thanks alot.
--
View this message in context:
2005 May 10
4
summary statistics for lists of matrices or dataframes
Is there a simple way to calculate summary statistics for all the
matrices or dataframes in a list? For example:
> z <- list(matrix(c(2,2,2,2), ncol = 2), matrix(c(4,4,4,4), ncol = 2))
> z
[[1]]
[,1] [,2]
[1,] 2 2
[2,] 2 2
[[2]]
[,1] [,2]
[1,] 4 4
[2,] 4 4
>
I would like to calculate, for example, the mean value for each
cell. I can do that the hard
2020 Jul 07
6
[RFC] C++20 ABI issue on several platforms
Hello,
as discussed here in more detail: https://reviews.llvm.org/D81583
the introduction of the C++20 [[no_unique_address]] attribute exposes an
ABI issue on platforms that require special handling for structs/classes
that are "equivalent" to a single floating-point member (or in some cases,
a "homogeneous" set of floating-point members). This is because we can now
for the
2010 Oct 03
1
Modifying a data.frame
Hello list members
I have a problem with modifying a data.frame.
As an example given is a data.frame called ex :
ex<-data.frame(id=c(1,2,3,4,5,6),obs=c(14,9,20,36,55,47),eff=c("A","A","B","C","C","C"))
After that I would like to modify the object ex with the following short script:
for (i in ex) {
if(ex[i,3]=="A"||