This may be like a very small question, but I need some help here.
Lets say I have a data frame (df) in R which reads like this:
X Y Z
Ras 56 89 76
Jyo 76 90 00
Abi 45 88 34
Poo 78 98 54
I wish to give a header to the first column and name it as "Names", so as to get the following output.
Names X Y Z
Ras 56 89 76
Jyo 76 90 00
Abi 45 88 34
Poo 78 98 54
When I check, it gives me the following headers:
> names(df)[1]
X
> names(df)[2]
Y
> names(df)[3]
Z
So I tried something like,
> names(df)[0] <- "Names"
But that did not do anything. Can anyone help me how do I give this "Names" header using R?