similar to: generating RANDOM ROWS from matrix

Displaying 20 results from an estimated 30000 matches similar to: "generating RANDOM ROWS from matrix"

2006 Mar 16
6
removing ROWS with missing values
I am trying to find out if R can recognize specific criteria for removing rows (i.e. a prexisting function) I have a matrix myMatrix that is 12000 by 20 I would like to remove rows from myMatrix that have: -999 across all columns -999 across all columns but one -999 across all columns but two -999 across all columns but three -999 across all columns but four -999 across all columns but five
2006 Apr 04
2
Selecting out certain values from a MATRIX
I have two objects, one matrix and one vector. I want to use my vector to subset certain values out of my matrix. For example: I want to tell R, to select out all rows in myMatrix into a new myMatrix2 IF that corresponding row is less than a 0.5 in myVector. So: myMatrix = a matrix of 8000 by 20 myVector = vector of 8000 myMatrix2 = a matrix of < 8000 by 20 (based on selection criteria in
2005 Nov 21
2
Removing Rows
I have a data frame with the following dimensions 217 x 5 I want to create two data frames from the original. 1) One containing every tenth row of the original data frame 2) Other containing the rest of the rows. How do I do this? I've tried subset() and calling the index. thank you in advance, [[alternative HTML version deleted]]
2006 Mar 07
7
reading in only one column from text file
How do I manipulate the read.table function to read in only the 2nd column??? [[alternative HTML version deleted]]
2011 Oct 11
2
binding all elements of list (character vectors) to a matrix as rows
dear r-users, i have got a problem which i am trying to solve: i have got the following commands: Mymatrix <- matrix(1:9,ncol=3) Z <- list("V1"=c("a","",""),"V2"=c("b","",""),"V3"=c("c","",""),"V4"=c("d","","")) Mymatrix <-
2004 Nov 01
5
make apply() return a list
Hi, I have a dataframe (say myData) and want to get a list (say myList) that contains a matrix for each row of the dataframe myData. These matrices are calculated based on the corresponding row of myData. Using a for()-loop to do this is very slow. Thus, I tried to use apply(). However, afaik apply() does only return a list if the matrices have different dimensions, while my matrices have
2012 Mar 20
1
Remove individual rows from a matrix based upon a list
Dear All, Thanks in advance for any help. I have a square matrix of measures of interactions among individuals and would like to calculate a values from a function (colSums for example) with a single individual (row) excluded in each instance. That individual would be returned to the matrix before the next is removed and the function recalculated. I can do this by hand removing rows based upon
2018 Jul 30
3
apply with zero-row matrix
Hi Martin, Fair enough for R functions in general. But the behaviour of apply violates the expectation that apply(m, 1, fun) calls fun n times when m has n rows. That seems pretty basic. Also, I understand from your argument why it makes sense to call apply and return a special result (presumably NULL) for an empty argument; but why should apply call fun? Cheers David On Mon, 30 Jul 2018 at
2005 Nov 09
6
elements in a matrix to a vector
hi all, i'm trying to get elements in a matrix into a vector. i need a "streamlined" way to do it as the way i'm doing it is not very serviceable. an example is a 3x3 matrix like 0 0 3 2 0 0 0 4 0 to a vector like 3 2 4 thanks...mj [[alternative HTML version deleted]]
2012 Jul 31
2
Remove a complete row as per the Range in a Matrix
Hi, Here i have a Matrix MyMatrix <- Name Age --------- ------- ANTONY 27 IMRAN 30 RAJ 22 NAHAS 32 GEO 42 and here i have an array with Minimum and Maximum values. MinMaxArray <- data.frame(MIN = 25,MAX=35) MIN MAX ------ -------- 25 35
2002 Mar 21
5
repeating rows or columns within a matrix
Hello Spse I have a matrix, say 1 2 3 4 5 6 7 8 9 and I would like to expand it by repeating rows within the matrix, to get, if the repeating factor is 2, say: 123 123 456 456 789 789 (or columnwise as well) . There must be a smart way of doing that? Many thanks Juhana Vartiainen juhana.vartiainen at labour.fi -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
2005 Nov 21
3
Comparing rows of matrices with different dimensions
Hi there, I have a question, which I thought is very easy to solve, but somehow I can't find a solution. Probably someone could help me quickly? Here it is: I have two matrices: a [,1] [,2] [,3] [1,] 1 4 9 [2,] 2 6 10 [3,] 3 6 11 [4,] 4 8 12 b [,1] [,2] [1,] 1 4 [2,] 2 5 [3,] 3 6 Now I want to find
2003 Nov 05
1
objects inside curly braces
Hello, I am running a program in r that calls a function, which calls another function, which calls another etc. These functions are of the form: example<- function(x,y,z) {x, y, and z are defined within curly braces like this} Here's my question. To start the main function, I input as an initial parameter a matrix of regressors of the form: MyMatrix<-cbind(this.one,that.one)
2012 Mar 31
1
basic subset question of matrix
Dear list, I would like to subset a large expression matrix based on rownames. That is, I have a list (as a txt-file) with gene names that matches some of the rows in my matrix. I've loaded my matrix as well as gene list using the read.table() command. myMatrix <- read.table("name_of_file.txt", header=T, row.names=1) list_to_keep <- read.table("name_of_file.txt",
2005 Aug 08
3
reverse order of matrix rows
Quick question: how can I reverse the order of the rows in a matrix? i.e. make the last row first and the first row last, etc.?
2012 Jul 19
2
Line chart with a double matrix
Hello, I have a double matrix that I want to represent in a line chart. Although I have seen some examples I still don't manage to get it. My data is this (a double matrix called mymatrix) : Blogs Wikis Redes Etiq. SPC LMS Menor de 30 57.14 28.57 14.29 28.57 57.14 28.57 de 31 a 40 63.83 61.70 29.79 17.02 59.57 70.21 de 41 a 50 72.64 70.75 47.17 20.75 55.66 75.47 Mayor de
2006 Apr 02
2
VARIANCE across each ROW
I have a very large matrix. I would like to display the variance across each row. In other words, I want to output a vector containing the values of variance across row. When I use the function var(), it seems to give me the variability of each column. Any ideas?? [[alternative HTML version deleted]]
2008 Oct 20
2
convert matrix to dataframe with repeating row names
Hi R, I have a matrix x with repeating row names. > dim(x) [1] 862 19 zz<-matrix(0,4,4) rownames(zz)=c("a","a","b","b") data.frame(zz) (?) I need to use x in a linear regression lm(as.formula(paste("final_dat[,5]~",paste(colnames(x),collapse="+"))),x ) this gives me a error Error in
2005 Feb 21
3
Sorting a matrix on two columns
Hello, If a matrix with 5 columns has been defined and the first two columns need to be sorted in ascending order, how can this be achieved whilst ensuring the other 3 columns data are in relative position to the sorted columns? Glen Jones [[alternative HTML version deleted]]
2005 Nov 22
4
the matrix of rows with specific row sums
I am just starting with R and have the following problem: given a matrix of ones and zeroes, say mdim=4 m<-matrix(round(runif(mdim^mdim)),mdim,mdim) how to construct the matrix of those rows of m, whose elements sum to 2. Contrary to the random matrix above, the actual matrix always has at least one such row. Serguei Kaniovski