1

I tried to change the name of a variable/column using the -dplyr- package but I am not having much luck.

Using the sample MaunaLoa data, I attempt to change the variable name from CO2 to ppm. Based on the help information, I specified new_name equal to old_name

MaunaLoa = read.csv("http://course1.winona.edu/bdeppa/FIN%20335/Datasets/CO2%20Mauna%20Loa.csv")
dplyr::rename(MaunaLoa, ppm = CO2)

The command seems to work fine but when I check, the variable name has not changed.

names(MaunaLoa)

"Time"  "Month" "Year"  "CO2" 

I get the following error message - I get the same message when using my own dataset so I am unsure of why.

Francesca
  • 63
  • 1
  • 7

1 Answers1

-2

assign change to data

MaunaLoa <- dplyr::rename(MaunaLoa, ppm = CO2)
dy_by
  • 1,061
  • 1
  • 4
  • 13