This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Setting the first row as column name in R

Hello,

I have a file -

GeneID      sample1          sample2        sample3        sample4        gene_length
gene1       count1           count2         count3         count4         length1
gene2       count1           count2         count3         count4         length2
gene3       count1           count2         count3         count4         length3
gene4       count1           count2         count3         count4         length4

When imported to R using read.table() I get columns assigned by default as V1, V2, V3 etc, but how can I set the first row as the column names?

GeneID    sample1    sample2    sample3    sample4    gene_length

Thanks

r

1 answer

Add Argument header=TRUE

Log in to answer this question.