similar to: Colapsar una matriz con NA en una única fila

Displaying 20 results from an estimated 300 matches similar to: "Colapsar una matriz con NA en una única fila"

2016 Oct 11
3
Colapsar una matriz con NA en una única fila
Javier Muchas gracias por su respuesta Aunque no está funcionando, pues si ejecuto: EncDTE1<- t.EncDTE1[ !is.na(t.EncDTE1$Var1),] obtengo Var1, Var2, Var3,...Varn con datos "texto", NA, NA....NA Pero al ejecutar EncDTE1<- t.EncDTE1[ !is.na(t.EncDTE1$Var2),] obtengo Var1, Var2, Var3,...Varn con datos NA,"texto", NA....NA Estoy tratando de dar la vuelta con el loop
2005 Feb 04
1
(no subject)
Hi. I have a problem that I can't seem to find an optimal way of solving other than by doing things manually. I'm trying to subset a data frame by the number of observations that occurred at a given row but want to take into account the number of observations of preceding rows. Here's an example. I'm looking at intervals of data [10,20), [10, 30), ....., [10,120) which contain a
2013 Mar 16
1
Errors or warnings for non-existent data
Good Evening Is there a setting that I can change in R so that I get either a warning or an error message if I reference non-existent data in a data frame? For example I get no warning or error message with the following: > set.seed(2013) > df0=data.frame(cbind(x=rnorm(1000),y=rnorm(1000))) > df0$z=df0$w > head(df0) x y 1 -0.09202453 1.51179695 2 0.78901912
2010 Oct 20
2
rowsum
Hello, I am trying to achieve something which I *think* is possible using rowsum, but a little help should be useful: Consider the following dataframe DF0: A B C 89 1 140 89 06 20 89 29 137 89 52 13 89 57 10 89 97 23 89 1 37 89 1 12 89 1 3 52 1 11 52 1 31 52 1 16 52 1 6 52 1 10 52 1 13 52 1 10 52 1 25 52 1 2 52 59 38 52 97 75 57 1 14 57 1 13 57 1 14 57 114 12 57 1 23 57 06 26 I need create a
2015 Aug 02
3
ayuda con análisis de supervivencia
Hola a todos, -Estoy estudiando el efecto de dos genotipos (~tratamientos) en la aparición de síndrome metabólico (MetS) con datos longitudinales recogidos a tiempo 0,7,10,15,20 y 25 años. -He hecho un dataframe con las siguientes variables MetS: Síndrome Metabólico (Si=1,No=0) bmi: Indice de masa corporal (IMC) cuando se produce la conversión a MetS+ . Para los que permancen MetS-, esta variable
2012 Feb 23
1
segfault when using data.table package in conjunction with foreach
Hi all, I'm trying to use the package read.table within a foreach loop. I'm grabbing 500M rows of data at a time from two different files and then doing an aggregate/tapply like function in read.table after that. I had planned on doing a foreach loop 39 times at once for the 39 files I have, but obviously that won't work until I figure out why the segfault is occurring. The
2015 Apr 10
5
Loop sobre muchos data frames
Jorge Gracias por el consejo. Aparentemente no lo estoy aplicando bien, pues el objeto que obtengo no contiene lo que quiero. Me explico, al ejecutar txt <- vector('list', length = length(names)) #names el el vector donde ya tenía almacenada la lista de txt's for(i in seq_along(txt)){ txt[[i]] <- Corpus(VectorSource(names[i])) } obtengo el objeto txt: > class(txt) [1]
2015 Apr 12
2
Loop sobre muchos data frames
Jorge, estimados colaboradores de R-help Estuve tratando de utilizar un script para uno de los pasos en mi análisis, que es transformar cada uno de los corpus en mi espacio de trabajo en un objeto TermDocumentMatrix Tengo un vector llamado bNames que lista todos los corpus que quiero pasar a TDM, y construí los siguientes comandos: tdm.n1 <- vector('list', length = length(bNames))
2018 Mar 07
2
Reglas de asociación en un cluster Hadoop
Hola, Quizás no es el ámbito más apropiado, pero vale la pena intentar. ¿Existe alguna implementación en R del modelo de reglas de asociación que pueda realizar el cálculo en paralelo sobre un cluster Hadoop? He visto los paquetes que 'paralelizan' R, pero no mencionan nada acerca de modelos de reglas de asociación. Saludos -- Oscar Benitez [[alternative HTML version deleted]]
2015 Apr 10
3
Loop sobre muchos data frames
Hola a todos! Estoy en un proyecto de text mining y por razones de los recursos con que cuento tuve que separar los archivos de texto de input del proyecto en muchos archivos pequeños. Luego de transformar cada uno de estos archivos en un corpus separado, puedo aplicar limpieza sobre cada corpus, buscar n-gramas, construir cada termDocumentMatrix y finalmente reunir todo en una sola TDM. Pero
2019 Nov 11
2
R en Jupyter Lab, error al cargar dplyr: "namespace 'rlang' 0.3.4 is being loaded, but >= 0.4.0 is required"
Hola Quiero ejecutar R desde Jupyter Lab y me encuentro con un error al invocar la librería dplyr. Este error no aparece cuando ejecuto RStudio. La sesión de R en jupyter lab: sessionInfo() R version 3.6.1 (2019-07-05) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 14393) Matrix products: default locale: [1] LC_COLLATE=Spanish_Chile.1252
2007 Nov 16
4
Permutation of a distance matrix
Hi there, I would like to find a more efficient way of permuting the rows and columns of a symmetrical matrix that represents ecological or actual distances between objects in space. The permutation is of the type used in a Mantel test. Specifically, the permutation has to accomplish something like this: Original matrix addresses: a11 a12 a13 a21 a22 a23 a31 a32 a33 Example
2007 Mar 14
0
cannot delete the last column of a dataframe using "[<-" (PR#9565)
Hi, If df is a dataframe, its last column can't be deleted using "[<-", but other columns can be deleted this way. Example: > (df <- df0 <- data.frame(x = 1:3, y = 4:6, z = 7:9)) x y z 1 1 4 7 2 2 5 8 3 3 6 9 > df[, "z"] <- NULL Error in x[[jj]] : subscript out of bounds > df[, 3] <- NULL Error in x[[jj]] : subscript out of bounds >
2009 Jul 10
3
strange strsplit gsub problem 0 is this a bug or a string length limitation?
I was working with the rmetrics portfolioBacktesting function and dug into the code to try to find why my formula with 113 items, i.e. A1 thru A113, was being truncated and I only get 85 items, not 113. Is it due to a string length limitation in R or is it a bug in the strsplit or gsub functions, or in my string? I'd very much appreciate any suggestions ============Input script:
2012 Mar 28
6
How to get all possible combinations?
Dear all, suppose I have a vector with elements as: Vec <- c(2,3,4,5,6) Now I want to have all possible combination of length 3 using those elements and without any repetition. Like, I want to have 1 possibility like 2-3-4 but not 3-2-4. Can somebody guide me how to achieve that in R? Thanks for your help.
2008 Nov 29
2
Reading mixed tables
Dear R buddies, This weekend I became interested in solving Google Code Jam problems using R. I guess R may work very well in this kind of contests but the input of file has been a problem for me. Take this case for example (http://code.google.com/codejam/contest/dashboard?c=agdjb2RlamFtchALEghjb250ZXN0cxjRzBQM), the files are usually of the form: A(number of lines for group 1) a11 a12 a13 a21
2012 Apr 25
2
GFI en modelos estructurales con lavaan
Se ha borrado un adjunto en formato HTML... URL: <https://stat.ethz.ch/pipermail/r-help-es/attachments/20120425/dafc9a68/attachment.html>
2012 Mar 28
9
¿Cuál es tu uso de R?....(Votación online)....
Hola, Llevaba tiempo pensando en lanzar esta pregunta a la lista, sobre "¿Cuál es vuestro uso de R?". Mejor que colapsar la lista, además de que seguramente por el tipo de respuestas (no estructuradas) complicaría su análisis, he decidido crear una encuesta online aqui: http://www.tuvotacion.com/cual-es-tu-uso-de-r La encuesta la he dividido en estas tres opciones básicas, que confío
2011 Nov 29
2
Help with recast() syntax
Dear Help-Rs,   I have data similar to the following:   DF <- structure(list(X = 1:22, RESULT = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("NEG", "POS"), class = "factor"), YR_MO = c(201011L, 201012L, 201101L, 201102L, 201103L, 201104L, 201105L, 201106L, 201107L, 201108L, 201109L, 201011L,
2012 Jan 13
2
read.table as integer
Hello, I have a csv file with many variables, both characters and integers. I would like to load it on R and do some operations on integer variables, the problem is that R loads the entire dataset considering all variables as characters, instead I would like that R makes the distinction between the two types, because there are too many variables to do: x1<-as.integer(x1)