Displaying 20 results from an estimated 3000 matches similar to: "Counting unique items in a list of matrices"
2003 Oct 31
2
Summing elements in a list
Hi,
Suppose that I have a list where each component is a list of two
matrices. I also have a vector of weights. How can I collapse my
list of lists into a single list of two matrices where each matrix
in the result is the weighted sum of the corresponding matrices.
I could use a loop but this is a nested calculation so I was hoping
there is a more efficient way to do this. To help clarify,
2011 Mar 15
4
Element by element mean of a list of matrices
Hi All,
is there any effiective and dense/compact method to calculate the mean of a list of - of course coincident - matrices on an element by element basis? The resulting matrix' [i, j]-th element is the mean of the list's matrices' [i, j]-th elements respectively...
Iterating by for statement is quite straightforward, but I am seeking for a more elegant solution, and my attempt with
2003 Apr 23
9
sum
Dear helpers
I have a list where each element is a matrix (the list is
obtained with lapply). I want to sum those matrices. Is there a
function to do that? The sum function sums all the elements...
--
http://adsl.sapo.pt
2011 Oct 17
0
[Reading mat files into R]
Dear R users,
I work with Matlab & R simultaneously. Usually I used to read successfully
mat files (cell, structure, etc.) into R, till Matlab 2011b release.
For reading mat files (or maybe I should say, converting it into R variable
or structure) I’m using *readMat* (from “R.matlab” package).
Even saving mat files in one of the previous formats (which can bet set in
preference panel)
2012 Sep 24
6
Script to count unique values from two linked matricies
I hope you can help with this one.
I have two matricies:
1. A species abundance matrix:
<http://r.789695.n4.nabble.com/file/n4643979/2species_matrix.jpg>
2. A species trait score matrix:
<http://r.789695.n4.nabble.com/file/n4643979/2trait_matrix.jpg>
The trait matrix lists trait scores for each species as listed in the
species abundance matrix.
I would like to create a script
2011 Nov 03
2
Take variables in data.frame and create list of matrices
Hi,
I have this sample data below and would like to create a list of matricies.
setseed(1254)
id <- c(1,1,1,1 ,2,2,2)
o <- as.factor(c(1:4, 1, 3, 4))
r <- rep(.5, 7)
v <- rnorm(7)
s <- rnorm(7)
dat <-data.frame(id, o, r, v, s)
dat
#> dat
# id o r v s
# 1 1 0.5 0.7024631 2.0813672
# 1 2 0.5 -0.5541955 0.1095156
# 1 3 0.5 -1.0418167 0.4164930
# 1
2012 Jan 05
1
match matrices of different lengths
was trying to match different matrices of different lengths with in
the first collumn date and time info (yearmonthdayhourminute). the
routine needs to return NA?s where data of either of the matrices is
non existent.
have been trying the following:
####
x <- c(200112030003, 200112030004, 200112030005, 200112030006)
y <- c(0.1, 1, 1.1, 1.5)
a <- c(200112030004, 200112030005,
2002 Nov 27
6
Rbind help needed
Dear list
I have a very simple question which is causing me problems!
I have a matrix A and simply want to rbind this matrix together n times (n is a large number)
How can I write this in R?
I know I could do new<-rbind(z,z,z,...z) with z written n times but this will take forever as n is so large.
Is there a simple way to write this?
Cheers
Mick
2011 Apr 18
2
Working with massive matrices in R
Hello,
I'm (eventually) attempting a singular value decomposition of a 3200 x
527829 matrix in R version 2.10.1. The script is as follows:
###---------Begin Script here-------###
library(Matrix)
snps <- 527829 ## Number of SNPs
N <- 3200 ## Sample size
y <- rnorm(N, 100,1) ## simulated phenotype
system.time(
## read in matrix
2007 Nov 26
3
Fwd: Empty list to use in a for cycle
? stato filtrato un testo allegato il cui set di caratteri non era
indicato...
Nome: non disponibile
Url: https://stat.ethz.ch/pipermail/r-help/attachments/20071126/35b0349a/attachment.pl
2011 Nov 07
4
rearrange set of items randomly
Dear all,
I hope that this question is not too weird, I will try to explain it as good
as I can.
I have to write a function for a school project and one limitation is that I
may not use the in built function sample()
At one point in the function I would like to resample/rearrange the items of
my sample (so I would want to use sample, but I am not allowed to do so), so
I have to come up with sth
2011 Jan 17
2
Difficult with round() function
Dear list,
I'm writing a function to re-grid a data set from finer to coarser
resolutions in R as follows (I use this function with sapply/apply):
gridResize <- function(startVec = stop("What's your input vector"),
to = stop("Missing 'to': How long do you want the fnial vector to be?")){
from <- length(startVec)
shortVec<-numeric()
tics <- from*to
2010 Aug 20
2
Determining the length of unique items in a vector
Dear all, let suppose I have following vector:
> dat1 <- c(rep("asd", 5), rep("xyz", 12), rep("erd", 17))
> dat1 <- dat1[sample(1:length(dat1), length(dat1), replace=F)]
> dat1
[1] "erd" "xyz" "erd" "asd" "asd" "erd" "xyz" "asd" "erd" "erd"
2007 May 21
3
an array of matrices
I'd like to have a three dimensional array of matrices. I thought I could construct a five dimensional array to have the three dimensional array of matrices. However, not all of the matrices in the array have the same dimensions, which seems to mean I can't use a five dimensional array.
What I'd like is this:
A = matrix(1:4,2,2)
B = matrix(1:25,5,5)
C = matrix(1,3,3)
D =
2018 Feb 25
1
reshaping column items into rows per unique ID
Hi Allaisone,
I took a slightly different approach but you might find this either as or
more useful than your approach, or at least a start on the path to a
solution you need.
df1 <-
data.frame(CustId=c(1,1,1,2,3,3,4,4,4),DietType=c("a","c","b","f","a","j","c","c","f"),
2009 Apr 03
1
Trouble extracting graphic results from a bootstrap
Hi,
I'm trying to extract a histogram over the results from a bootstrap. However
I keep receiving the error message "Error in hist.default(boot.lrtest$ll,
breaks = "scott") : 'x' must be numeric".
The bootstrap I'm running looks like:
> boot.test <- function(data, indeces, maxit=20) {
+ y1 <- fit1+e1[indeces]
+ mod1 <- glm(y1 ~ X1-1, maxit=maxit)
+
2018 Feb 25
0
reshaping column items into rows per unique ID
Hi Allaisone,
If you want a data frame as the output you will have to put up with a
few NA values unless each Customer has the same number of diet types:
a1df<-read.table(text="CustomerID DietType
1 a
1 c
1 b
2 f
2 a
3 j
4
2005 Jul 10
5
Indices and totals
Hi all!
I've read http://reactor-core.org/ogg-tagging.html and
http://www.vorbis.com/ot/20030303.html#id2726753 about the goals and
non-goals of vorbis comments, but I'm still unsure:
1) Is it by purpose to forget about CDA's index feature because it's so
rarely used or did nobody here ever thought about it?
-> Add an INDEXNUMER field?
2) If "Vorbis comments are the
2018 Feb 25
0
reshaping column items into rows per unique ID
I believe you need to spend time with an R tutorial or two: a data frame
(presumably the "table" data structure you describe) can *not* contain
"blanks" -- all columns must be the same length, which means NA's are
filled in as needed.
Also, 8e^5 * 7e^4 = 5.6e^10, which almost certainly will not fit into any
local version of R (maybe it would in some server version --
2009 Jul 13
4
Combine two matricies
Hi,
I have two matricies a and x:
a<-matrix(c(3,4,5,2,3,4,1,1,2), nrow=3, ncol=3)
[,1] [,2] [,3]
[1,] 3 2 1
[2,] 4 3 1
[3,] 5 4 2
x<-matrix(c(3, NA, NA, NA, 2, 5, NA, 2, 2), nrow=3, ncol=3)
[,1] [,2] [,3]
[1,] 3 NA NA
[2,] NA 2 2
[3,] NA 5 2
I wish to combine these two into one matrix using the values from x where x has values, and