I have a question about the colnames() function in the base package
Let's say you have a data.frame, as follows:
df <- data.frame(variable=letters[1:100], value=rnorm(100))
As one would expect, colnames(df[1]) returns:
colnames(df[1])
[1] "variable"
However, it doesn't seem that assignment is possible when calling a specific column
colnames(df[1]) <- c("test")
colnames(df[1])
[1] "variable"
Why is that?