similar to: Remove and add to many matrices in list.

Displaying 20 results from an estimated 40000 matches similar to: "Remove and add to many matrices in list."

2012 Nov 27
2
Stuck trying to modify a function
Hi, I have the following data: Path_Number <- 5 ID.Path <- c(1:Path_Number) # Make vector of ID's. No_of_X <- sample(50:550, length(ID.Path), replace=TRUE) # X <- split(sample(1:10000, sum(No_of_X), replace=TRUE), rep(ID.Path, No_of_X)) Y <- lapply(X,function(x) sample(x, round(runif(1, min=10, max=50)))) X and Y are both lists, and I've made the following function to
2013 Jan 25
3
Removal of columns from matrix where all values of the column are identical.
Hi all, I'd like to write a piece of code which will remove columns from a matrix, if the column contains only one value, say every value in the column is a "3": Matrix <- matrix(NA, nrow=5, ncol=4) Matrix[,1] <- c(1,2,3,4,5) Matrix[,2] <- c(3,3,3,3,3) Matrix[,3] <- c(5,4,3,2,1) Matrix[,4] <- c(5,1,4,3,2) [,1] [,2] [,3] [,4] [1,] 1 3 5 5 [2,] 2
2013 May 03
2
Declare a set (list?) of many dataframes or matrices
Hi, I would like to read several datasets and would like to create a set (list? sequence?) of many empty dataframes. How could this be done? How could I declare a set (list? sequence?) of many empty matrices? Thanks, Miao [[alternative HTML version deleted]]
2012 Oct 28
6
Having some Trouble Data Structures
Hi All, I'm trying to run a simulation of host-pathogen evolution based around individuals. What I need to have is a dataframe or table of some description - describing all the individuals of a pathogen population (so far I've implemented this as a matrix): ID No_of_Effectors Effectors (Sequences) [1,] 0001 3 ## 3
2007 Jun 05
2
generating many matrices
I'd like to generate many matrices (let's say 100 matrices of 4x4), of which diagonal elements are being drawn from each set of sample of known distribution. What would be the best way? I've been trying to find any previous threads for this topic, but haven't been able to find one. Thanks. Kevin [[alternative HTML version deleted]]
2007 Apr 27
4
Randomising matrices
I would like to be able to randomise presence-absence (i.e. binary) matrices whilst keeping both the row and column totals constant. Is there a function in R that would allow me to do this? I'm working with vegetation presence-absence matrices based on field observations. The matrices are formatted to have sites as rows and species as columns. The presence of a species on a site is
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
2009 Mar 27
2
adding matrices with common column names
folks, if i have three matrices, a, b, cc with some colnames in common, and i want to create a matrix which consists of the common columns added up, and the other columns tacked on, what's a good way to do it? i've got the following roundabout code for two matrices, but if the number of matrices increases, then i'm a bit stymied. > a <- matrix(1:20,ncol=4); colnames(a) <-
2012 Nov 18
1
identical matrices
Dear R users, I want to check matrices when i change the order of the rows or/and the order of the columns or/and the combination of them i will give an example what i want  1  -1  1  1      1  1   1  1 -1  -1 -1 -1    -1 -1  -1  -1   1  1    1  1     1 -1    1   1 these 2 matrices are identical because i change the first row and make it third   1  -1  1  1      -1  1   1  1 -1  -1 -1
2013 Apr 24
2
Distance matrices Combinations
Dear UseRs, MY PROBLEM IS A SMALL PIECE OF A REAL BIG AND A COMPLICATED PROBLEM. IF I DELIBERATE IN A VERY SIMPLE WAY THEN ALL I WANT IS TO PUT ALL THE POSSIBLE COMBINATIONS OF 75 DISTANCE MATRICES (BY TAKING 4 MATRICES, MORE COMMONLY 75C4), in the following equation. t<-as.matrix((MAT1)^2+(MAT2)^2+(MAT3)^2+(MAT4)^2+,upper=T,diag=T)) Then "1215450" values of "t"(one for
2003 Sep 10
4
recording and taking mean of a set of matrices
I'm looking for a good form in which to store matrix results of a simulation. I am doing a simulation study. Each simulation generates some data and then analyzes it. I want to record the results of many simulations and analyze them. Say r has the results of one simulation, and I care about r$coefficients, a vector of coefficients, and r$var, the estimated covariance matrix. I'll do
2013 Feb 04
0
Subscript out of Bounds Lapply
Hi all, I've written a function for a simulation which will - in general operation without being specific to the simulation scenario, duplicate or delete columns from a matrix based on two values which determine how many as a proportion of the matrix: the two values are always between 0.01 and 0.99: Dup.Dels <- function(matrix, values){ p.dup <-
2008 Jan 08
1
storing matrices in a list or vector and preserve dimensions
Hi all, As an R newbie, I wonder how I can store multiple matrices in a list() or vector() object without losing their structure. I should be able to retrieve the matrix from the list later on. If I just append() the matrices to a list() object, they automatically lose their dimensions, whereas I would like to preserve the dimensions of the matrices. Is there any function in R which allows
2003 Jul 12
2
using cut on matrices
Dear list, I'd like to use the function cut() on matrices, ie that when I apply it to a matrix, it would return a matrix of the same dimensions instead of a vector. I wonder if there is a better (more elegant) solution than matrix(cut(a, ...), ncol=ncol(a), nrow=nrow(a)) because I would like to use cut on both vectors and matrices and avoid testing whether a is a matrix. Thanks, Tamas
2013 Feb 13
3
date and matrices
Hi Elisa, Try this: date1<-format(seq.Date(as.Date("1991.1.1",format="%Y.%m.%d"),as.Date("1996.12.31",format="%Y.%m.%d"),by="day"),"%Y.%m.%d") ?length(date1) #[1] 2192 mat1<-matrix(c(.314,.314,.273,.273,.236,.236,.236,.236,.273,.314,.403,.314),ncol=1) res1<-
2013 Mar 22
1
Median across matrices
Hey all, I have a list of matrices. I'd like to calculate the median across all those matrices for each element. What I'd like to end up with is a matrix containing the median of all [1,1] [1,2] etc. elements across all matrices. Is there a concise way of doing that? Thanks!
2009 Jul 15
1
problem with merging matrices
Dear all, I'm a relative new user of R and I have a problem with merging a collection of matrices. All matrices in this collection have the same dimension (532 rows and 532 columns), but can differ in the row and columns names. I'd like to merge these matrices in such a way that the resulting matrix only contains unique row- and column-names and that in case of a match between the row or
2009 Jul 28
3
selecting vector elements using matrices and combining the results
I've been scratching my head over this one for too long. I'm hoping someone out there can solve this riddle. I have two vectors of characters, v1 and v2, both of length L, and two matrices of logicals, m1 and m2, both of dimension N*L. The first matrix of logicals corresponds to the first vector of characters, and the second to the second. The matrices are telling me which of the
2013 Feb 14
3
list of matrices --> array
i'm somehow embarrassed to even ask this, but is there any built-in method for doing this: my_list <- list() my_list[[1]] <- matrix(1:20, ncol = 5) my_list[[2]] <- matrix(20:1, ncol = 5) now, knowing that these matrices are identical in dimension, i'd like to unfold the list to a 2x4x5 (or some other permutation of the dim sizes) array. i know i can initialize the array, then
2009 Jan 11
1
Boxplot from matrices
Hii, I will create boxplots from matrices. I have the following data sets: 5.0 1.78 2.99 2.019 0 10.0 1.79 3.00 1.744 0 15.0 1.78 2.98 1.936 0 20.0 1.78 2.99 1.975 0 25.0 1.73 2.91 3.591 0 30.0 1.79 3.00 1.966 0 35.0 1.79 3.00 2.451 0 40.0 1.79 3.00