Can anyone explain what's going on here? setting row.name= NULL makes no difference compared to when I dont specify it, yet when I set row.names=1, it says duplicate row.names not allowed? How do I resolve this to get column V1 as rownames?
ak1a = read.table("/Users/abhaykanodia/Desktop/smallRNA/AK1a_counts.txt", row.names = NULL)
head(ak1a)
V1 V2
1 ENSG00000000003.15 2
2 ENSG00000000005.6 0
3 ENSG00000000419.14 21
4 ENSG00000000457.14 0
5 ENSG00000000460.17 2
6 ENSG00000000938.13 0
ak1a = read.table("/Users/abhaykanodia/Desktop/smallRNA/AK1a_counts.txt")
head(ak1a)
V1 V2
1 ENSG00000000003.15 2
2 ENSG00000000005.6 0
3 ENSG00000000419.14 21
4 ENSG00000000457.14 0
5 ENSG00000000460.17 2
6 ENSG00000000938.13 0
ak1a = read.table("/Users/abhaykanodia/Desktop/smallRNA/AK1a_counts.txt", row.names = 1)
Error in read.table("/Users/abhaykanodia/Desktop/smallRNA/AK1a_counts.txt", :
duplicate 'row.names' are not allowed
From the helpfile you can read:
That explains the same behavior when you set row.names=NULL or when you use its default value.
You can set row.names as in this example:
which displays: