Estimados Tengo un problema, creo que sencillo, pero hay algo que hice mal, coloco el código, básicamente desde igraph se realiza un análisis, y se me ocurre tener un data.frame para ordenar los resultados, pero justo en ese punto aparece un problema. ¿Alguna sugerencia?> version_ platform x86_64-w64-mingw32 arch x86_64 os mingw32 system x86_64, mingw32 status major 3 minor 2.5 year 2016 month 04 day 14 svn rev 70478 language R version.string R version 3.2.5 (2016-04-14) nickname Very, Very Secure Dishes> number_edges_vertex <- as.data.frame(degree(datos.network)) > colnames(number_edges_vertex) <-c('var','grados')Error in `colnames<-`(`*tmp*`, value = c("var", "grados")) : 'names' attribute [2] must be the same length as the vector [1]> str(number_edges_vertex)'data.frame': 216 obs. of 1 variable: $ degree(datos.network): num 9 10 7 9 7 10 10 12 8 9 ... Javier Rubén Marcuzzi [[alternative HTML version deleted]]
Por lo que envías, number_edges_vertex es un data frame con una sola variable, por lo que da error cuando quieres asignar el nombre de sus columnas como si fuesen 2 variables No sé si te refieres a eso... -----Mensaje original----- De: R-help-es [mailto:r-help-es-bounces en r-project.org] En nombre de Javier Marcuzzi Enviado el: miércoles, 1 de junio de 2016 0:51 Para: R-help-es en r-project.org Asunto: [R-es] data.frame colname igraph Estimados Tengo un problema, creo que sencillo, pero hay algo que hice mal, coloco el código, básicamente desde igraph se realiza un análisis, y se me ocurre tener un data.frame para ordenar los resultados, pero justo en ese punto aparece un problema. ¿Alguna sugerencia?> version_ platform x86_64-w64-mingw32 arch x86_64 os mingw32 system x86_64, mingw32 status major 3 minor 2.5 year 2016 month 04 day 14 svn rev 70478 language R version.string R version 3.2.5 (2016-04-14) nickname Very, Very Secure Dishes> number_edges_vertex <- as.data.frame(degree(datos.network)) > colnames(number_edges_vertex) <-c('var','grados')Error in `colnames<-`(`*tmp*`, value = c("var", "grados")) : 'names' attribute [2] must be the same length as the vector [1]> str(number_edges_vertex)'data.frame': 216 obs. of 1 variable: $ degree(datos.network): num 9 10 7 9 7 10 10 12 8 9 ... Javier Rubén Marcuzzi [[alternative HTML version deleted]] _______________________________________________ R-help-es mailing list R-help-es en r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es
Envío el mismo código con un head, observar que el data.frame no es al estilo:
           degree(datos.network)
1 Ficha 1022                     9
2 Ficha 1024                    10
> version
               _                           
platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          2.5                         
year           2016                        
month          04                          
day            14                          
svn rev        70478                       
language       R                           
version.string R version 3.2.5 (2016-04-14)
nickname       Very, Very Secure Dishes    > number_edges_vertex <- as.data.frame(degree(datos.network))
> head(number_edges_vertex)
           degree(datos.network)
Ficha 1022                     9
Ficha 1024                    10
Ficha 1028                     7
Ficha 1053                     9
Ficha 1111                     7
Ficha 1127                    10> colnames(number_edges_vertex)
<-c('Caracteristica','grados')
Error in `colnames<-`(`*tmp*`, value = c("Caracteristica",
"grados")) :
  'names' attribute [2] must be the same length as the vector [1]
> 
Javier Rubén Marcuzzi
De: JCMld
Enviado: miércoles, 1 de junio de 2016 3:08
Para: 'Javier Marcuzzi'; R-help-es en r-project.org
Asunto: RE: [R-es] data.frame colname igraph
Por lo que envías, number_edges_vertex es un data frame con una sola
variable, por lo que da error cuando quieres asignar el nombre de sus
columnas como si fuesen 2 variables
No sé si te refieres a eso...
-----Mensaje original-----
De: R-help-es [mailto:r-help-es-bounces en r-project.org] En nombre de Javier
Marcuzzi
Enviado el: miércoles, 1 de junio de 2016 0:51
Para: R-help-es en r-project.org
Asunto: [R-es] data.frame colname igraph
Estimados
Tengo un problema, creo que sencillo, pero hay algo que hice mal, coloco el
código, básicamente desde igraph se realiza un análisis, y se me ocurre
tener un data.frame para ordenar los resultados, pero justo en ese punto
aparece un problema.
¿Alguna sugerencia? 
> version
               _                           
platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          2.5                         
year           2016                        
month          04                          
day            14                          
svn rev        70478                       
language       R                           
version.string R version 3.2.5 (2016-04-14)
nickname       Very, Very Secure Dishes    > number_edges_vertex <- as.data.frame(degree(datos.network))
> colnames(number_edges_vertex) <-c('var','grados')
Error in `colnames<-`(`*tmp*`, value = c("var",
"grados")) :
  'names' attribute [2] must be the same length as the vector
[1]> str(number_edges_vertex)
'data.frame':	216 obs. of  1 variable:
 $ degree(datos.network): num  9 10 7 9 7 10 10 12 8 9 ...
Javier Rubén Marcuzzi
	[[alternative HTML version deleted]]
_______________________________________________
R-help-es mailing list
R-help-es en r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es
	[[alternative HTML version deleted]]