## Based on a dplyr::rename question by Meghan Duffy
# https://twitter.com/duffy_ma/status/583674070526459904

df<- data.frame(alpha=1:3, beta=4:6)
names(df)
## [1] "alpha" "beta"
library (dplyr)
## 
## Attaching package: 'dplyr'
## 
## The following object is masked from 'package:stats':
## 
##     filter
## 
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
# Renames on the fly
df %>% rename(A = alpha)
##   A beta
## 1 1    4
## 2 2    5
## 3 3    6
df
##   alpha beta
## 1     1    4
## 2     2    5
## 3     3    6
# Permanently renames
df <- rename(df, A = alpha)
df
##   A beta
## 1 1    4
## 2 2    5
## 3 3    6