3

我无法row.names在函数中指定正确的参数read.table()

这是简单的文字:

 name      sex     age  height  
1 x1        F       18   162  
2 x2        M       19   170  
3 x3        M       21   178  
4 x4        F       22   166  
5 x5        F       23   165  

当我读到:

data1=read.table('test',head=T,sep='',row.names=T)  
invalid 'row.names' specification  

data1=read.table('test',head=T,sep='',row.names=T)  
invalid 'row.names' specification 

其他信息:

> version  
               _                            
platform       i686-pc-linux-gnu             
arch           i686                           
os             linux-gnu                      
system         i686, linux-gnu                
status                                        
major          2                              
minor          15.1                           
year           2012                           
month          06                             
day            22                             
svn rev        59600                         
language       R                              
version.string R version 2.15.1 (2012-06-22)  
nickname       Roasted Marshmallows          
4

1 回答 1

10

read.table参数row.names中必须输入一个数字(即包含行名称的列号)或名称向量。请参阅?read.table完整说明。这里:

data1 <- read.table('test',header=T,sep=" ",row.names=1)
于 2012-07-23T08:08:11.497 回答