similar to: number of an element in a matrix

Displaying 20 results from an estimated 7000 matches similar to: "number of an element in a matrix"

2008 Aug 05
2
max size of a matrix
Hi R users, I am trying to create a matrix, but R has problem with the size of dim, wondering if there is anything that I can do? > a <- diag(147456) Error in array(0, c(n, p)) : 'dim' specifies too large an array Thanks for your help Rostam [[alternative HTML version deleted]]
2008 Aug 12
1
converting rgb() output to 0-255
Hi, I have three matrices, Red, Green and Blue. I would like to produce a matrix which is the combined values of Red, Green and Blue matrices. I know rgb() does the job, but the values are not between 0-255, they are in the following format: "#2C312C" I would like to have the values between 0-255. I wonder if you could tell me what I can do... Thanks for your help, Rostam
2008 Aug 01
1
creating image using RGB values
Hi R users, I would like to create an image using three matrices which contain the values of Red, Green, and Blue of each pixel, i.e. one matrix which has values of red, one which has values of green, and one which has values of blue. The values are between 0 and 1 instead of 0-255. I have obtained the matrices using the getChannels of pixmap library. I wonder if anyone knows how to create the
2008 Sep 04
1
showing the image
Hi everyone, I have a matrix containing color values of an image same as following, [1,] "#444444" "#444444" "#434343" "#404040" "#3D3D3D" "#3D3D3D" "#3E3E3E" [2,] "#414141" "#414141" "#414141" "#404040" "#3F3F3F" "#3F3F3F" "#3F3F3F" [3,] "#3E3E3E"
2008 Nov 14
1
running r script in windows command line
Hi, I would like to run a saved script in windows command line. Some command which takes the filename as an argument, and runs it in R. Thanks, Rostam [[alternative HTML version deleted]]
2008 Aug 11
1
Simple lme/lmer random effects questions
Hello, I have two very rudimentary questions regarding the random effects terms in the lme and lmer functions. I apologize if this also partly strays into a general statistics question, but I'm a bit new to this all. So hopefully it'll be a quick problem to sort out... Here is my experimental setup: I raised butterflies in 5 different testing chambers all set to different
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 <-
2003 May 07
4
element of
Dear all, is there any funktion in R which i can use to check if a single value is element of a matrix or data.frame so that it returns me logical values like TRUE/FALSE. Thanks in advance for your help!
2008 Aug 03
0
neighbors of an element of a matrix
Hi R users, I wonder if there is any function which would render the value of the neighbors of the given element [i,j] of a matrix. Thanks, Rostam [[alternative HTML version deleted]]
2009 Nov 25
5
How to sum only a few elements in a line
Hello, I have a matrix with the numbers 0,1 and 9 I would like to write a function that could sum each line skiping everytime a number 9 appears for example [0 1 0 1 1 9 1] the sum would be 4. However I cannot replace 9 by 0 otherwise after the sum is done I wouldn?t be able to distiguish which ones were real zeros and which ones were nines replaced by zero just to sum. Thank you very much --
2013 Jun 27
3
using "rollapply" to calculate a moving sum or running sum?
#using "rollapply" to calculate a moving sum or running sum? #I am tryign to use rollapply to calcualte a moving sum? #I tried rollapply and get the error message #"Error in seq.default(start.at, NROW(data), by = by) : # wrong sign in 'by' argument" #example: mymatrix <- ( matrix(data=1:100, nrow=5, ncol=20) ) mymatrix_cumsum <- ( matrix(data=NA, nrow=5,
2009 Jul 20
1
S4 method dispatch with inheritance
Hi, I'm trying to create a new S4 class (myMatrix) which for now just extends dgCMatrix (from package Matrix). Then I want to use "[" which is defined in Matrix. Out of the box with "[" (defined in Matrix) I lose the class information and the result is an object of class dgCMatrix. If I specify a "["-method for myMatrix, it is not used because a signature
2005 Jan 21
6
Avoiding a Loop?
Dear R-Helpers, I have a matrix where the first column is known. The second column is the result of multiplying this first column with a constant "const". The third column is the result of multiplying the second column with "const"..... So far, I did it like this (as a simplified example): nr.of.columns <- 4 myconstant <- 27.5 mymatrix <- matrix(numeric(0), nrow=5,
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]]
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
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 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
2008 May 21
2
Converting Data Types
Hi, How can I convert the matrices to list. For example I have this snippet: samples<-mymatrix[1,] print(samples) which prints: V1 V2 V3 V4 V5 V6 1 103.9 88.5 242.9 206.6 175.7 164.4 How can I convert the object "samples" such that it prints: [1] 103.9 88.5 242.9 206.6 175.7 164.4 The reason I ask this because I can't use the former "samples"
2012 Aug 01
1
Error message: $ operator is invalid for atomic vectors
HI, The code was working perfectly fine yesterday and today, until half an hour ago.? Couldn't find any problems in the code. Still, I am getting error message. myMatrix <- data.matrix(read.table(text=" Name??????????? Age ANTONY??????? 27 IMRAN????????? 30 RAJ????????????????? 22 NAHAS????????? 32 GEO??????????????? 42 ", header=TRUE)) MinMaxArray? <- data.frame(MIN =
2007 Feb 12
3
processing a large matrix
I would like to compare every column in my matrix with every other column and get the r-squared. I tried using the following formula and looping through every column: > summary(lm(matrix[,x]~matrix[,y]))$r.squared If I have 10,000 columns, the loops (10,000 * 10,000) take forever even if there is no formula inside. Then, I attempted to vectorize my code: > cor(matrix)^2 With 10,000