Reputation: 1365
I am unable to specify the correct argument for row.names
in the function read.table()
here is simple text:
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
when i read:
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
Other info:
> 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
Upvotes: 3
Views: 5811
Reputation: 18749
In read.table
the argument row.names
has to be inputted with a number (i. e. the column number that contains the row names) or a vector of names. See ?read.table
for a complete explanation. Here:
data1 <- read.table('test',header=T,sep=" ",row.names=1)
Upvotes: 10