similar to: Extract from matrix

Displaying 20 results from an estimated 11000 matches similar to: "Extract from matrix"

2007 Mar 02
5
extracting rows from a data frame by looping over the row names: performance issues
Hi, I have a big data frame: > mat <- matrix(rep(paste(letters, collapse=""), 5*300000), ncol=5) > dat <- as.data.frame(mat) and I need to do some computation on each row. Currently I'm doing this: > for (key in row.names(dat)) { row <- dat[key, ]; ... do some computation on row... } which could probably considered a very natural (and R'ish) way of
2001 Nov 14
2
lme: how to extract the variance components?
Dear all, Here is the question: For example, using the "petrol" data offered with R. pet3.lme<-lme(Y~SG+VP+V10+EP,random=~1|No,data=petrol) pet3.lme$sigma gives the residual StdDev. But I can't figure out how to extract the "(intercept) StdDev", although it is in the print out if I do "summary(pet3.lme)". In
2007 Nov 29
2
library(RII)
Se ha borrado un texto insertado con un juego de caracteres sin especificar... Nombre: no disponible Url: https://stat.ethz.ch/pipermail/r-help/attachments/20071129/f0d6a91a/attachment.pl
2011 Oct 27
2
Trying to create a function to extract values from a matrix
My issue seems simple but I can't find any method to work... I've got a matrix with 4 columns and I want to extract the values from each row to make a new 2x2 matrix for each row. From these resultant matrices, I want to get the Eigen Values and output them from the function as usable numbers (not a text string). Here's the function... ### Ef = function(MAT) {for(i in
2007 Aug 28
1
Age-Length key with kimura algorith
Se ha borrado un texto insertado con un juego de caracteres sin especificar... Nombre: no disponible Url: https://stat.ethz.ch/pipermail/r-help/attachments/20070828/6641b572/attachment.pl
2007 Jul 31
5
extract columns of a matrix/data frame
Hello all, I have a matrix whose column names look like a1 a2 b1 b2 b3 c1 c2 1 2 3 7 1 3 2 4 6 7 8 1 4 3 Now, I can have any number of a's. not just two as shown above and same goes for b's and c's. I need to extract all the a's columns and put them in another matrix, extract all b's columns and put them in some matrix
2011 Mar 13
4
readMat - how to retrieve the variables
Hello I have a matlab MAT file that contains one single variable: a. The structure of a is as follows: a.river1.flow (flow values) a.river1.date_flow (date) a.river1.precip (precipitation values) a.river1.date_precip a.river2.flow a.river2.date_flow a.river2.precip a.river2.date_precip I have used readMat to load the variable a in R, however I have no idea how readMat translates a. I managed
2004 May 27
4
extract columns using their names
Hello, Is there a way to extract multiple columns from a dataframe using their names instead of their numbers? Currently I use: data2 <- data1[, c(1,3,9)] And I am looking for something like data2 <- data1[, c("XX","YY","ZZ")] I use the same dataframe for many purposes, and I run codes that change the order of the columns every time. Many thanks, Adrian
2011 Feb 07
1
how to return multipy matrix in a function
Hello I have a 100*100 matrix which is from a intensive computation, e.g. mat. Is there any method/function that return the max of every row and the subscript of maximum value simultaneously #define the function > returnfunction<-function(x){ + value<-apply(x,1,max) + index<-apply(x,1,which.max) + } > mat<-matrix(c(3,5,7,2,1,10,4,3,2),3)#initilize the matrix for test >
2010 Nov 29
1
Extracting selected rows from a matrix
Hi, I have matrix of 104 columns and 30000 rows (Each Row has rowname). I have 13 different  list of selected rownames (character) say 1000 each. Now I want to extract the all the columns according to the rownames in each the list. How can I do that in R ? 1 ) For a single list 2) For all the 13 list at a time  Regards, Pankaj Barah Department of Biology,  Norwegian University of
2015 Apr 07
2
Informes periódicos con R
Hola Jorge Perdona que sea tan pesado, pero no encuentro el fichero docx. Tampoco me manejo muy bien con RStudio. He insertado lo que me has dicho; pero solo tengo en la pantalla la opción “Knit HTML” y siempre me genera un HTML. He instalado “pander” pero no obtengo el docx Gracias Jesús De: Jorge I Velez [mailto:jorgeivanvelez en gmail.com] Enviado el: martes, 07 de abril de 2015
2003 May 22
7
extract half a matrix
Dear all, I'm new to matrix operations in R. I couln't find a solution to the following problem among earlier help mails or in An introd to R, I guess because the question is really basic. I want to extract all above the diagonal, i.e. from 1 2 3 4 1 0 26 49 49 2 26 0 44 40 3 49 44 0 21 4 49 40 21 0 I want 26 49 44 49 40 21 Thanks in advance! Sincerely, Tord
2006 Dec 24
2
FW: Passing lists from R to C, extracting elements, and sending lists back again
Thank you to everyone who responded to my previous post regarding the integration into R of C programs that use external libraries. I have another issue that I simply have not been able to figure out using documentation, list archives, and so forth. I have data that is stored in R lists. I would like to pass the list to C code using the .Call function, perform mathematical operations on the
2015 Apr 08
2
Temas para word markdown
Buenas, estaba siguiendo el hilo de Informes Periódicos en R de Jesus Herranz y me surgió una duda. Actualmente estoy tratando de usar markdown para todo así cualquier cosa que haga me queda presentable para informar o presentar en algún lugar. En general estoy usando html y o pdf principalmente porque cuando trato de compilar en word la verdad que queda bastante feíto. Alguién sabe, o puede
2006 Aug 04
3
Lyrics stored in .ogg files?
Hi, I've heard somewhere that it is possible to store inside .ogg files text streams and thus it should be possible to store lyrics for the sond directly in the file. Is it true? Could anybody point me towards some code how to do it (Python preferable, but not required)? Is there any documentation for text streams in .ogg files? Thanks for any reply, Mat?j -- GPG Finger: 89EF 4BC6 288A
2008 Mar 03
1
Extracting data from Eigen function
Hi I need to extract the data returned by Eigen to plot the eigenvectors. However, when I try and eigv = eigen(covariance); it returns an object with the matrices containing eigenvalues and vectors.. how can I extract the eigenvector matrix from this?? When I try mat = eig["vectors"] it returns a matrix with the "$vectors" string on top , how can I remove this? code: > eig
2004 Dec 10
1
subset bug?
I ran into a problem with "subset" while working at home that I am not sure is a bug or not. I defined a custom function to take a data frame of tree positions, sizes, and types (containing the columns TRT, COMP, PLOT, X, Y, DBH and CON) and wanted to make a stem map of the plot using different symbols and colors to represent the different types of tree stems. I copied a bit of the
2023 Jan 27
3
implicit loop for nested list
> > I am looking for a more elegant way to write below code. > > #Simulation results have different dimensions > mysim <- lapply(1:10, function(y) { > two.mat <- matrix(rnorm(4), nrow = 2) > four.mat <- matrix(rnorm(16), nrow = 4) > list(two.mat = two.mat, four.mat = four.mat) #results with different dimensions > }) > > #Collect different
2010 Aug 03
4
Need help on upper.tri()
HI, I am really messing up to make a symmetrical matrix using upper.tri() & lower.tri() function. Here is my code:   > set.seed(1) > mat = matrix(rnorm(25), 5, 5) > mat            [,1]       [,2]       [,3]        [,4]        [,5] [1,] -0.6264538 -0.8204684  1.5117812 -0.04493361  0.91897737 [2,]  0.1836433  0.4874291  0.3898432 -0.01619026  0.78213630 [3,] -0.8356286  0.7383247
2017 Jan 19
2
Error en loop anidado con data.table
Hola tengo una tabla de tipo data.frame "datos" con la siguiente estructura, simplificada en número de niveles por variable, para crear un ejemplo más sencillo: id anio t_8a t_10a t_12a rankf8 rankf10 rankf12 1 1 100 220 220 NA NA NA 2 1 140 350 350 NA NA NA 3 2 55 165 165 NA NA NA 4 2 60 200 200 NA NA NA 5 2 100 NA NA NA NA NA 6 3 NA 350 350 NA NA NA También tengo una matriz,