Reputation: 69
I am a beginner in r and I am currently trying to change the name of my variables. There is a column called "var" and the column has two variables: Índice de volume de vendas no comércio varejista and Índice de receita nominal de vendas no comércio varejista, respectively. I would like to rename the first variable to "volume" and the second one to "receita". In order to do this I already tried to use the rename function, but it is not working. I already tried the following code:
rename(pmc_rvar, volume = Índice de volume de vendas no comércio varejista (Número-índice))
The following answer appears: Erro: unexpected symbol in "rename(pmc_rvar, volume = Índice de"
Upvotes: 0
Views: 3757
Reputation: 516
As you have got blank spaces, you need to either put the whole column name into backticks, or you need to remove or fill the blank spaces.
Try this:
library(dplyr)
pmc_rvar <- rename(pmc_rvar, volume = `Índice de volume de vendas no comércio varejista
(Número-índice)`)
Upvotes: 1