r - unable to set names to a vector or matrix -


probably easy one, still can't work. have matrix of values:

browse[2]> x      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [1,] 48.6 83.1   21  155 63.1 47.4 49.6 59.1 17.5  20.4     0     0     0     0 

and have matrix contains values i'd consider names:

browse[2]> a[0,]  [1] x2.000 x2001  x2002  x2003  x2004  x2005  x2006  x2007  x2008  x2009  x2010  x2011  x2012  x2013  <0 rows> (or 0-length row.names) 

i'm trying set names of x i'm unable to:

browse[2]> colnames (x) <-a[0,] browse[2]> x      numeric(0) character(0) character(0) character(0) character(0) character(0) character(0) character(0) character(0) [1,]       48.6         83.1           21          155         63.1         47.4         49.6         59.1         17.5      character(0) character(0) character(0) character(0) character(0) [1,]         20.4          0            0            0         

what doing wrong?

in r , index starts 1. probably, op looking column names of 'a'.

colnames(x) <- colnames(a) 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -