Rename columns in R

1 min read

Rename a single column

Let's start with a simple data frame containing 4 columns:

df <- data.frame(

col1 = c(1,2,3),

col2 = c(4,5,6),

col3 = c(7,8,9),

col4 = c(10,11,12)

)